This is my plugin for android and one of my method requires a context, Is there a way how can I get this context?
public class GaziruPlugin extends CordovaPlugin{ @Override public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException { String value = args.getString(0); BASE64Decoder decoder = new BASE64Decoder(); try { byte[] imageByte = decoder.decodeBuffer(value); Classlogic method = new Classlogic(); //this method requires a context type. method.DoLogic(context,imageByte); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } return false; }
}
I hope you can help me. Thanks
Apache Cordova and Adobe PhoneGap provide a way for developers to develop apps for all major platforms in HTML, CSS and JavaScript. Developers only have to maintain a single codebase for all platforms. The project started out as PhoneGap and when it was acquired by Adobe the code was released as Apache Cordova.
try to put this into your plugin:
Context context=this.cordova.getActivity().getApplicationContext();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With