public class RegistrationBroadcastReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { String action = intent.getAction(); if (NgnRegistrationEventArgs.ACTION_REGISTRATION_EVENT.equals(action)) { NgnRegistrationEventArgs arguments = intent.getParcelableExtra(NgnEventArgs.EXTRA_EMBEDDED); if (arguments == null) { Log.d(Constants.TAG, "Invalid event arguments"); return; } switch (arguments.getEventType()) { case REGISTRATION_NOK: Toast.makeText(context, "Failed to register", Toast.LENGTH_SHORT).show(); Log.d(Constants.TAG, "Failed to register"); break; case REGISTRATION_OK: Log.d(Constants.TAG, "You are now registered"); break; case REGISTRATION_INPROGRESS: Log.d(Constants.TAG, "Trying to register..."); break; case UNREGISTRATION_NOK: Toast.makeText(context, "Failed to unregister", Toast.LENGTH_SHORT).show(); Log.d(Constants.TAG, "Failed to unregister"); break; case UNREGISTRATION_OK: Log.d(Constants.TAG, "You are now unregistered"); break; case UNREGISTRATION_INPROGRESS: Log.d(Constants.TAG, "Trying to unregister..."); break; } } } }