Search code examples
androidandroid-intentandroid-c2dmgoogle-cloud-messaging

when the method OnUnregistered() will be invoked in GCMIntentService Class


I have successfully implemented the GCM framework for push notification in my android application.But I am little bit confused about the function overridden in GcmIntentService Class by Google.

@Override
protected void onUnregistered(Context context, String registrationId) {

//Do whatever you want

}

When this method will get invoked ?


Solution

  • It will be called after you have unregistered from the GCM servers using the GCMRegistrar.unregister() method.

    As documented here in the GCMBaseIntentService docs:

    Called after a device has been unregistered.

    You should also take a look at the How Unregistration Works documentation as it describes the two ways a device will be unregistered: manually and automatically.