Commit 05e1e72e by Sebastián Katzer

Assign static vars at plugin initialization

parent dc5089c9
...@@ -25,6 +25,7 @@ import java.util.Map; ...@@ -25,6 +25,7 @@ import java.util.Map;
import java.util.Set; import java.util.Set;
import org.apache.cordova.CallbackContext; import org.apache.cordova.CallbackContext;
import org.apache.cordova.CordovaInterface;
import org.apache.cordova.CordovaPlugin; import org.apache.cordova.CordovaPlugin;
import org.apache.cordova.CordovaWebView; import org.apache.cordova.CordovaWebView;
import org.json.JSONArray; import org.json.JSONArray;
...@@ -53,10 +54,15 @@ public class LocalNotification extends CordovaPlugin { ...@@ -53,10 +54,15 @@ public class LocalNotification extends CordovaPlugin {
public static Context context = null; public static Context context = null;
@Override @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.webView = super.webView;
LocalNotification.context = super.cordova.getActivity().getApplicationContext(); LocalNotification.context = super.cordova.getActivity().getApplicationContext();
}
@Override
public boolean execute (String action, JSONArray args, CallbackContext callbackContext) throws JSONException {
if (action.equalsIgnoreCase("add")) { if (action.equalsIgnoreCase("add")) {
JSONObject arguments = args.optJSONObject(0); JSONObject arguments = args.optJSONObject(0);
final Options options = new Options(context).parse(arguments); final Options options = new Options(context).parse(arguments);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment