private boolean internalRegister(JSONArray data, CallbackContext callbackContext) {
    JSONObject params = null;
    try {
      params = data.getJSONObject(0);
    } catch (JSONException e) {
      e.printStackTrace();

      callbackContext.error(e.getMessage());
      return true;
    }

    callbackIds.put("registerDevice", callbackContext);

    try {
      String appid = null;
      if (params.has("appid")) appid = params.getString("appid");
      else appid = params.getString("pw_appid");

      mPushManager = new PushManager(cordova.getActivity(), appid, params.getString("projectid"));
    } catch (JSONException e) {
      callbackIds.remove("registerDevice");
      e.printStackTrace();

      callbackContext.error(e.getMessage());
      return true;
    }

    try {
      if (loggedStart) {
        mPushManager.onStartup(cordova.getActivity(), false);
      } else {
        mPushManager.onStartup(cordova.getActivity(), true);
        loggedStart = true;
      }
    } catch (java.lang.RuntimeException e) {
      callbackIds.remove("registerDevice");
      e.printStackTrace();

      callbackContext.error(e.getMessage());
      return true;
    }

    checkMessage(cordova.getActivity().getIntent());
    return true;
  }
  /** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.main);

    // NetworkUtils.useSSL = true;

    // Register receivers for push notifications
    registerReceivers();

    // Create and start push manager
    PushManager pushManager = new PushManager(this, APP_ID, SENDER_ID);
    pushManager.onStartup(this);

    // The commented code below shows how to use geo pushes
    // pushManager.startTrackingGeoPushes();

    // The commented code below shows how to use local notifications
    // PushManager.clearLocalNotifications(this);

    // easy way
    // PushManager.scheduleLocalNotification(this, "Your pumpkins are ready!", 30);

    // expert mode
    // Bundle extras = new Bundle();
    // extras.putString("b", "https://cp.pushwoosh.com/img/arello-logo.png");
    // extras.putString("u", "50");
    // PushManager.scheduleLocalNotification(this, "Your pumpkins are ready!", extras, 30);

    mGeneralStatus = (TextView) findViewById(R.id.general_status);
    mTagsStatus = (TextView) findViewById(R.id.status);
    mIntTags = (EditText) findViewById(R.id.tag_int);
    mStringTags = (EditText) findViewById(R.id.tag_string);

    checkMessage(getIntent());

    mSubmitTagsButton = (Button) findViewById(R.id.submit_tags);
    mSubmitTagsButton.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            // PushManager.getTagsAsync(MainActivity.this, tagsListener);
            checkAndSendTagsIfWeCan();
          }
        });

    SendTagsFragment sendTagsFragment = getSendTagsFragment();
    mTagsStatus.setText(sendTagsFragment.getSendTagsStatus());
    mSubmitTagsButton.setEnabled(sendTagsFragment.canSendTags());
  }
  private PluginResult internalRegister(JSONArray data, String callbackId) {
    JSONObject params = null;
    try {
      params = data.getJSONObject(0);
    } catch (JSONException e) {
      e.printStackTrace();
      return new PluginResult(Status.ERROR);
    }

    try {
      mPushManager =
          new PushManager(
              cordova.getActivity(), params.getString("appid"), params.getString("projectid"));
    } catch (JSONException e) {
      e.printStackTrace();
      return new PluginResult(Status.ERROR);
    }

    try {
      if (loggedStart) {
        mPushManager.onStartup(cordova.getActivity(), false);
      } else {
        mPushManager.onStartup(cordova.getActivity(), true);
        loggedStart = true;
      }
    } catch (java.lang.RuntimeException e) {
      e.printStackTrace();
      return new PluginResult(Status.ERROR);
    }

    checkMessage(cordova.getActivity().getIntent());

    callbackIds.put("registerDevice", callbackId);

    PluginResult result = new PluginResult(Status.NO_RESULT);
    result.setKeepCallback(true);
    return result;
  }
 public void onStartup(Context context) {
   onStartup(context, true);
 }