Skip to content

Instantly share code, notes, and snippets.

@edewit
Last active August 29, 2015 14:03
Show Gist options
  • Save edewit/325869843f0efc60765e to your computer and use it in GitHub Desktop.
Save edewit/325869843f0efc60765e to your computer and use it in GitHub Desktop.
@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