public static void registerForCloudMessaging(Context context) {
    String regId = gcmRegisterIfNot(context);

    // Register to WordPress.com notifications
    if (AccountHelper.isSignedInWordPressDotCom()) {
      if (!TextUtils.isEmpty(regId)) {
        // Send the token to WP.com in case it was invalidated
        NotificationsUtils.registerDeviceForPushNotifications(context, regId);
        AppLog.v(T.NOTIFS, "Already registered for GCM");
      }
    }

    // Register to Helpshift notifications
    HelpshiftHelper.getInstance().registerDeviceToken(context, regId);
    AnalyticsTracker.registerPushNotificationToken(regId);
  }
 /**
  * Check if user has valid credentials, and that at least 2 minutes are passed since the last
  * ping, then try to update the PN token.
  */
 private void updatePushNotificationTokenIfNotLimited() {
   // Synch Push Notifications settings
   if (isPushNotificationPingNeeded() && AccountHelper.isSignedInWordPressDotCom()) {
     String token = null;
     try {
       // Register for Google Cloud Messaging
       GCMRegistrar.checkDevice(mContext);
       GCMRegistrar.checkManifest(mContext);
       token = GCMRegistrar.getRegistrationId(mContext);
       String gcmId = BuildConfig.GCM_ID;
       if (gcmId == null || token == null || token.equals("")) {
         AppLog.e(T.NOTIFS, "Could not ping the PNs backend, Token or gmcID not found");
       } else {
         // Send the token to WP.com
         NotificationsUtils.registerDeviceForPushNotifications(mContext, token);
       }
     } catch (Exception e) {
       AppLog.e(T.NOTIFS, "Could not ping the PNs backend: " + e.getMessage());
     }
   }
 }