@Override
 public void onResume() {
   super.onResume();
   if (!AccountHelper.isMyTBAEnabled(getActivity())) {
     // show a dialog to reenable myTBA
     final AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
     final Intent authIntent = AuthenticatorActivity.newInstance(getActivity(), false);
     builder.setTitle("myTBA is Disabled");
     builder
         .setMessage("Do you want to enable myTBA?")
         .setPositiveButton(
             "Yes",
             (dialog, which) -> {
               getActivity().startActivity(authIntent);
               getActivity().finish();
               dialog.cancel();
             })
         .setNegativeButton(
             "No",
             (dialog, which) -> {
               dialog.cancel();
             });
     builder.create().show();
   }
 }
 public static void registerGCMIfNeeded(Activity activity) {
   if (!AccountHelper.checkGooglePlayServicesAvailable(activity)) {
     Log.w(Constants.LOG_TAG, "Google Play Services unavailable. Can't register with GCM");
     return;
   }
   final String registrationId = GCMAuthHelper.getRegistrationId(activity);
   if (TextUtils.isEmpty(registrationId)) {
     // GCM has not yet been registered on this device
     Log.d(Constants.LOG_TAG, "GCM is not currently registered. Registering....");
     GCMAuthHelper.registerInBackground(activity);
   }
 }