public void registerPushAccount() {
   GCMRegistrar.checkDevice(this);
   GCMRegistrar.checkManifest(this);
   if (GCMRegistrar.isRegistered(this)) {
     Log.d("info", GCMRegistrar.getRegistrationId(this));
   }
   String regId = GCMRegistrar.getRegistrationId(this);
   if (regId.equals("")) {
     GCMRegistrar.register(this, AppConstants.PUSH_NOTIFICATION_KEY);
     Log.d("info", GCMRegistrar.getRegistrationId(this));
     regId = GCMRegistrar.getRegistrationId(this);
   } else {
     Log.d("info", "already registered as" + regId);
   }
   prefsEditor.putString(AppConstants.PREFPUSHREGISTRATIONID, regId);
   Log.d("info", regId);
   prefsEditor.commit();
 }
  @Override
  public boolean execute(String action, JSONArray data, CallbackContext callbackContext) {

    boolean result = false;

    Log.v(LOG_TAG, "execute: action=" + action);

    if (INITIALIZE.equals(action)) {
      pushContext = callbackContext;
      JSONObject jo = null;

      Log.v(LOG_TAG, "execute: data=" + data.toString());

      try {
        jo = data.getJSONObject(0).getJSONObject("android");

        gWebView = this.webView;
        Log.v(LOG_TAG, "execute: jo=" + jo.toString());

        gSenderID = jo.getString("senderID");

        Log.v(LOG_TAG, "execute: senderID=" + gSenderID);

        // https://github.com/t-nonque/phonegap-plugin-push/commit/c54439b721741c77b7b4de38af690ee6a25d88a4
        boolean registered = GCMRegistrar.isRegistered(getApplicationContext());
        if (!registered) {
          GCMRegistrar.register(getApplicationContext(), gSenderID);
        }
        result = true;
      } catch (JSONException e) {
        Log.e(LOG_TAG, "execute: Got JSON Exception " + e.getMessage());
        result = false;
        callbackContext.error(e.getMessage());
      }

      if (jo != null) {
        SharedPreferences sharedPref =
            getApplicationContext()
                .getSharedPreferences(COM_ADOBE_PHONEGAP_PUSH, Context.MODE_PRIVATE);
        SharedPreferences.Editor editor = sharedPref.edit();
        try {
          editor.putString("icon", jo.getString("icon"));
        } catch (JSONException e) {
          Log.d(LOG_TAG, "no icon option");
        }
        try {
          editor.putString("iconColor", jo.getString("iconColor"));
        } catch (JSONException e) {
          Log.d(LOG_TAG, "no iconColor option");
        }
        editor.putBoolean("sound", jo.optBoolean("sound", true));
        editor.putBoolean("vibrate", jo.optBoolean("vibrate", true));
        editor.putBoolean("clearNotifications", jo.optBoolean("clearNotifications", true));
        editor.commit();
      }

      if (gCachedExtras != null) {
        Log.v(LOG_TAG, "sending cached extras");
        sendExtras(gCachedExtras);
        gCachedExtras = null;
      }

    } else if (UNREGISTER.equals(action)) {

      GCMRegistrar.unregister(getApplicationContext());

      Log.v(LOG_TAG, "UNREGISTER");
      result = true;
      callbackContext.success();
    } else {
      result = false;
      Log.e(LOG_TAG, "Invalid action : " + action);
      callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.INVALID_ACTION));
    }

    return result;
  }