Wednesday, 15 August 2012

java - Callback From Activity on Cordova -


I have an activity called 'signature' and I say it to the Cordova plugin;

Plugin.java

signature.java

  Private zero finishes with string (string result, int position) {bundle conData = new bundle (); ConData.putString ("Results", Results); Intent = intent (); Intent.putExtras (conData); SetResult (status, intent); End(); }  

However, when I call the "Cordova. StartActivity Foresil" function "Onactive Results", then he immediately invites himself.

Firstly, some code was missing ( return statement for execute - Math) and you have to wait Android / Cordova-plugin until NO_RESULT and setKeepCallback PluginResult otherwise execute Cordoba / Android -method to get a result It is expected:

Plugin.java:

  throws JSonexception to public boolean execution (string action, JSNARRA RGR, callbackcontext callbackcontext) {pluginsR = new plugin (plugin) Result Status .NO_RESULT); R.setKeepCallback (true); CallbackContext.sendPluginResult (R); I = new intent (reference, signature class); I.setFlags (Intent.FLAG_ACTIVITY_NEW_TASK); Cordova.startActivityForResult (this, I, 90); Back true; } Public Zero on the Activative Result (Int. Requestcode, the result of int code, Intent Intent) {// Here is your first code ... ... Send to the last callPulin Give this result. Callback .Wire())); // When there is no direct result, use your execution method as a result of the plugins because most of the plugins I saw and prefer to send (reminder) to the plugin again, success / error // callbackContext.success (result.toString ( )); }  

Example (for your plugin class) and (for your signature category).

And one of mine: and more.


No comments:

Post a Comment