Last active
August 29, 2015 14:03
-
-
Save edewit/325869843f0efc60765e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Override | |
| public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException { | |
| if ("echo".equals(action)) { | |
| this.echo(args.getString(0), callbackContext); | |
| return true; | |
| } | |
| return false; // Returning false results in a "MethodNotFound" error. | |
| } | |
| public void echo(String echo, CallbackContext callbackContext) { | |
| final PluginResult result; | |
| if (echo != null && echo.length() > 0) { | |
| result = new PluginResult(PluginResult.Status.OK, echo); | |
| } else { | |
| result = new PluginResult(PluginResult.Status.ERROR); | |
| } | |
| callbackContext.sendPluginResult(result); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment