Skip to content Skip to sidebar Skip to footer

Unable To Send Callback To More Than One Cordova.exec

I am building a phonegap application and have called a java native plugin from it using cordova.exec. I am stuck somewhere unexpected. I am calling cordova.exec multiple times in a

Solution 1:

Try this.

1.In your execute() method of your plugin save the callbackId you get and return a NO_RESULT plugin result and set keep callback id to true.

PluginResultpluginResult=newPluginResult(PluginResult.Status.NO_RESULT); 
pluginResult.setKeepCallback(true); 
return pluginResult;

2.When your async java method finishes return another plugin result like this:

PluginResult result = new PluginResult(PluginResult.Status.OK, data); 
result.setKeepCallback(false); 
this.success(result, this.myCallbackId);

Post a Comment for "Unable To Send Callback To More Than One Cordova.exec"