Commit 05e1e72e authored by Sebastián Katzer's avatar Sebastián Katzer
Browse files

Assign static vars at plugin initialization

parent dc5089c9
Loading
Loading
Loading
Loading
+7 −1
Changes for src/android/LocalNotification.java: 7 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ import java.util.Map;
import java.util.Set;

import org.apache.cordova.CallbackContext;
import org.apache.cordova.CordovaInterface;
import org.apache.cordova.CordovaPlugin;
import org.apache.cordova.CordovaWebView;
import org.json.JSONArray;
@@ -53,10 +54,15 @@ public class LocalNotification extends CordovaPlugin {
    public static Context context          = null;

    @Override
    public boolean execute (String action, JSONArray args, CallbackContext callbackContext) throws JSONException {
    public void initialize (CordovaInterface cordova, CordovaWebView webView) {
        super.initialize(cordova, webView);

        LocalNotification.webView = super.webView;
        LocalNotification.context = super.cordova.getActivity().getApplicationContext();
    }

    @Override
    public boolean execute (String action, JSONArray args, CallbackContext callbackContext) throws JSONException {
        if (action.equalsIgnoreCase("add")) {
            JSONObject arguments  = args.optJSONObject(0);
            final Options options = new Options(context).parse(arguments);