Пример #1
0
 @Override
 protected void onResume() {
   super.onResume();
   if (mPendingAuth) {
     mPendingAuth = false;
     String regId = C2DMessaging.getRegistrationId(mContext);
     if (regId != null) {
       DeviceRegistrar.registerWithServer(mContext, regId);
     } else {
       C2DMessaging.register(mContext, DeviceRegistrar.SENDER_ID);
     }
     mTextView.setText(R.string.status_registering);
   }
 }
 @Override
 protected void onUnregistered(Context context, String registrationId) {
   Log.i(TAG, "Device unregistered");
   DeviceRegistrar.unregisterWithServer(context, registrationId);
 }
 @Override
 protected void onRegistered(Context context, String registrationId) {
   Log.i(TAG, "Device registered: regId = " + registrationId);
   DeviceRegistrar.registerWithServer(context, registrationId);
 }