@Override
    public void initPushHandling(String senderID) {
      if (MPConfig.DEBUG) Log.d(LOGTAG, "initPushHandling");

      if (!ConfigurationChecker.checkPushConfiguration(mContext)) {
        Log.i(LOGTAG, "Can't start push notification service. Push notifications will not work.");
        Log.i(LOGTAG, "See log tagged " + ConfigurationChecker.LOGTAG + " above for details.");
      } else { // Configuration is good for push notifications
        final String pushId = getPushId();
        if (pushId == null) {
          if (MPConfig.DEBUG) Log.d(LOGTAG, "Registering a new push id");

          try {
            Intent registrationIntent = new Intent("com.google.android.c2dm.intent.REGISTER");
            registrationIntent.putExtra(
                "app", PendingIntent.getBroadcast(mContext, 0, new Intent(), 0)); // boilerplate
            registrationIntent.putExtra("sender", senderID);
            mContext.startService(registrationIntent);
          } catch (SecurityException e) {
            Log.w(LOGTAG, e);
          }
        } else {
          MixpanelAPI.allInstances(
              new InstanceProcessor() {
                @Override
                public void process(MixpanelAPI api) {
                  if (MPConfig.DEBUG) Log.d(LOGTAG, "Using existing pushId " + pushId);
                  api.getPeople().setPushRegistrationId(pushId);
                }
              });
        }
      } // endelse
    }
 private void handleRegistrationIntent(Intent intent) {
   final String registration = intent.getStringExtra("registration_id");
   if (intent.getStringExtra("error") != null) {
     Log.e(LOGTAG, "Error when registering for GCM: " + intent.getStringExtra("error"));
   } else if (registration != null) {
     if (MPConfig.DEBUG) Log.d(LOGTAG, "Registering GCM ID: " + registration);
     MixpanelAPI.allInstances(
         new InstanceProcessor() {
           @Override
           public void process(MixpanelAPI api) {
             api.getPeople().setPushRegistrationId(registration);
           }
         });
   } else if (intent.getStringExtra("unregistered") != null) {
     if (MPConfig.DEBUG) Log.d(LOGTAG, "Unregistering from GCM");
     MixpanelAPI.allInstances(
         new InstanceProcessor() {
           @Override
           public void process(MixpanelAPI api) {
             api.getPeople().clearPushRegistrationId();
           }
         });
   }
 }