@Override protected boolean onRecoverableError(Context context, String errorId) { // log message log.i(TAG, "Received recoverable error: " + errorId); CommonUtilities.displayMessage(context, getString(R.string.gcm_recoverable_error, errorId)); return super.onRecoverableError(context, errorId); }
/** Method called on receiving a deleted message */ @Override protected void onDeletedMessages(Context context, int total) { log.i(TAG, "Received deleted messages notification"); String message = getString(R.string.gcm_deleted, total); CommonUtilities.displayMessage(context, message); // notifies user generateNotification(context, "delete message" + "", "deleted", total + ""); }
/** Method called on device registered */ @Override protected void onRegistered(Context context, String registrationId) { log.i(TAG, "Device registered: regId = " + registrationId); CommonUtilities.displayMessage(context, "Your device registred with GCM"); LoginActivity.regId = registrationId; // ServerUtilities.register(context, MainActivity.name, // MainActivity.email, registrationId); // Toast.makeText(this, "services: "+registrationId, // Toast.LENGTH_SHORT).show(); }
/** Method called on Error */ @Override public void onError(Context context, String errorId) { log.i(TAG, "Received error: " + errorId); Toast.makeText(this, "Received error: ", Toast.LENGTH_SHORT).show(); CommonUtilities.displayMessage(context, getString(R.string.gcm_error, errorId)); }
/** Method called on device un registred */ @Override protected void onUnregistered(Context context, String registrationId) { log.i(TAG, "Device unregistered"); CommonUtilities.displayMessage(context, getString(R.string.gcm_unregistered)); // ServerUtilities.unregister(context, registrationId); }