Creating a DroidScript Plugin which wraps a Cordova Plugin ========================================================== Note: This is still a work in progress but should work for simple Cordova Plugins. 1. Grab and extract the Android source files from your Cordova plugin and place them in your DroidScript Plugin src folder. 2. Add the CallbackContext.java and PluginResult.java files to your DroidScript Plugin src folder. 3. In your DroidScript Plugin's Init function create an instance of your Cordova plugin:- //Create Cordova plugin object. m_mega = new MegaPlugin( this ); Execute( "MyId", "init", "[]" ); 4. Add the following code to your main DroidScript plugin file:- //--- Implement fake Cordova interface ----------- //Execute a plugin action. public void Execute( String callbackId, String action, String args ) throws Exception { Log.d( TAG, "Execute: " + action + ", " + args ); CallbackContext callbackContext = new CallbackContext( callbackId, this ); //Get params to JSON array. JSONArray jsonArray; if( args.length() > 0 ) jsonArray = new JSONArray( args ); else jsonArray = new JSONArray(); m_mega.execute( action, jsonArray, callbackContext ); } public void sendPluginResult(PluginResult result, String callbackId) { //Todo //this.bridge.getMessageQueue().addPluginResult(result, callbackId); //String params = Escape.escapeJavaScript( result.toSuccessCallbackString( callbackId ) ); //m_ev.OnEvent( params ); } public void sendJavascript( String command ) { //Todo Log.d( TAG, "sendJavascript:" + command ); } public Activity getActivity() { return (Activity)m_ctx; } //---------------------------------------------------