Skip to content

BasePlugin to make android plugin development easier with less boilerplate

Notifications You must be signed in to change notification settings

IOCare/aerogear-reflect-cordova

 
 

Repository files navigation

android-base-plugin

This plugin makes creating android plugins easier by providing plugin developers a similar API as in iOS. Instead of having to write logic like this:

@Override
public boolean execute(String action, JSONArray data, CallbackContext callbackContext) throws JSONException {

    if (action.equals("greet")) {

        String name = data.getString(0);
        String message = "Hello, " + name;
        callbackContext.success(message);

        return true;

    } else {

        return false;

    }
}

You can just add this plugin as a dependency and extend it instead of CordovaPlugin. Then instead of needing to override execute you can just implement a method that has the the format action(params, callbackContext) example:

public boolean greet(String name, CallbackContext callbackContext) {
  String message = "Hello, " + name;
  callbackContext.success(message);

  return true;
}

Removing a lot of boilerplate that was needed before.

About

BasePlugin to make android plugin development easier with less boilerplate

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 93.3%
  • JavaScript 6.7%