package com.cordovacn.www;

import org.apache.cordova.CallbackContext;
import org.apache.cordova.CordovaPlugin;
import org.apache.cordova.PluginResult;

public class customPlugin extends CordovaPlugin {

    public static final String METHOD_ECHO = "echo";

    /**
     * Executes the request and returns PluginResult.
     *
     * @param action            The action to execute.
     * @param args              JSONArray of arguments for the plugin.
     * @param callbackContext   The callback context used when calling back into JavaScript.
     * @return                  True if the action was valid, false otherwise.
     */
    public boolean execute(String action, JSONArray args, final CallbackContext callbackContext) throws JSONException {

        this.callbackContext = callbackContext;

        if (action.equals(customPlugin.METHOD_ECHO)) {
            final String isRunBackgroud = args.getString(0);
            if(isRunBackgroud.equals("false")) {
                callbackContext.success("Invoke success!");
            } else if(isRunBackgroud.equals("true")) {
                this.cordova.getThreadPool().execute(new Runnable() {
                    public void run() {
                        callbackContext.success("Invoke success(background)!");
                    }
                });
            } else {
                callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.ERROR, "ERROR!"));
            }
        } else {
            return false;
        }
        return true;
    }
}

@@ -145,16 +145,76 @@
 Result;%0A
+import org.json.JSONArray;%0Aimport org.json.JSONException;%0A%0A%0A
 %0Apublic 
@@ -252,25 +252,29 @@
 ovaPlugin %7B%0A
+    
 %0A
-
     public s
@@ -314,16 +314,20 @@
 %22echo%22;%0A
+    
 %0A    /**
@@ -814,25 +814,24 @@
 ption %7B%0A
-%0A
         
 this.cal
@@ -826,48 +826,8 @@
     
-this.callbackContext = callbackContext;%0A
 %0A   

fix java issue