Plugin class deprecated in Phonegap

I noticed that the Plugin class in Phonegap is deprecated, so now there is a plugin replacement, how can I communicate between java and JavaScript without using the JavaScript Interface class and the plugin class

thanking you

+2
android cordova
Feb 20 '13 at 4:53
source share
1 answer

Plugins have changed a bit in the recent release, instead of the PluginClass extension, it now extends CordovaPlugin. You can find how to create plugins in white papers.

Link to android plugin development guide

public class Echo extends CordovaPlugin { @Override public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException { if (action.equals("echo")) { String message = args.getString(0); this.echo(message, callbackContext); return true; } return false; } private void echo(String message, CallbackContext callbackContext) { if (message != null && message.length() > 0) { callbackContext.success(message); } else { callbackContext.error("Expected one non-empty string argument."); } } } 
+2
Feb 20 '13 at 6:46
source share



All Articles