package com.selfservit.notify;

import com.google.firebase.iid.FirebaseInstanceId;
import com.google.firebase.FirebaseApp;

import org.json.JSONArray;
import org.json.JSONException;
import org.apache.cordova. * ;
import org.json.JSONObject;

import java.util.logging.Handler;

public class mPushNotification extends CordovaPlugin {
	//private static CallbackContext tokenRefreshCallbackContext;

	@Override
	public boolean execute(final String action, JSONArray args, final CallbackContext callbackContext) throws JSONException {
		// FirebaseApp.initializeApp(cordova.getActivity());
		if (action.equals("GetToken")) {
			getToken(callbackContext);
		}
		return true;
	}
	public static void getToken(CallbackContext callbackContext){
		try {
			String token = FirebaseInstanceId.getInstance().getToken();
			callbackContext.success(token);
		} catch (Exception e) {
			callbackContext.error(e.getMessage());
		}
	}
}

@@ -25,16 +25,156 @@
 otify;%0A%0A
+import android.content.Context;%0Aimport android.os.Bundle;%0Aimport android.util.Log;%0A%0Aimport com.google.firebase.analytics.FirebaseAnalytics;%0A
 import c
@@ -216,16 +216,16 @@
 anceId;%0A
-
 import c
@@ -379,43 +379,8 @@
 t;%0A%0A
-import java.util.logging.Handler;%0A%0A
 publ
@@ -435,18 +435,18 @@
  %7B%0A%09
-//
+%0A%09
 private 
 stat
@@ -445,61 +445,455 @@
 ate 
-static CallbackContext tokenRefreshCallbackC
+FirebaseAnalytics mFirebaseAnalytics;%0A%09@Override%0A%09protected void pluginInitialize() %7B%0A%09%09final Context context = this.cordova.getActivity().getApplicationContext();%0A%09%09//final Bundle extras = this.cordova.getActivity().getIntent().getExtras();%0A%09%09this.cordova.getThreadPool().execute(new Runnable() %7B%0A%09%09%09public void run() %7B%0A%09%09%09%09Log.d(%22log%22, %22Starting Firebase plugin%22);%0A%09%09%09%09mFirebaseAnalytics = FirebaseAnalytics.getInstance(c
 ontext
+)
 ;%0A%0A
+%09%09%09%7D%0A%09%09%7D);%0A%09%7D%0A
 %09@Ov

Update mPushNotification.java