How to pass data from Cordova to native Android?
JS side
var exec = require('cordova/exec');
exports.checkTemperature = function(photoPath, success, error) {
exec(success, error, 'Temperature', 'checkTemperature', [photoPath]);
};
Android native side
@Override
public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException {
this.callbackContext = callbackContext;
if (action.equals("checkTemperature")) {
String photoPath = args.getString(0);
...
return true;
}
return false;
}
Leave a Reply