I need to implement some functionality that triggers an action on an interval and emits the results back to javascript.
To simplify things I will use the echo examp
Just if it helps somebody, in Android I am not using PluginResult and I am still able to keep a reference to the CallbackContext and call it anytime. I am not sure if this is the right way, but I can confirm that it worked for me.
You'll want to have something like:
NSString *myCallbackId;
as an instance-level variable (outside of any method, so it retains its value). Set it when you first come in to the plugin code:
myCallbackId = command.callbackId;
Then, right after you instantiate a PluginResult, but before using it, do something like:
[pluginResult setKeepCallback:[NSNumber numberWithBool:YES]];
That will tell it to keep the callback valid for future use.
Then do something like:
[self.commandDelegate sendPluginResult:pluginResult callbackId:myCallbackId];
hi for getting many callback to js you can use setKeepCallback(true)
eg
PluginResult p3= new PluginResult(PluginResult.Status.OK, "0");
p3.setKeepCallback(true);