I am using the new GCM APIs in order to register. The documentation of the method clearly states:
Register the application for GCM and return the registration ID. You must call this once, when your application is installed, and send the returned registration ID to the server.
Repeated calls to this method will return the original registration ID.
However, while reading this article (http://developer.android.com/google/gcm/adv.html#reg-state), it states that there are two cases that need special treat:
There are also two other scenarios that require special care:
- Application update
- Backup and restore
When an application is updated, it should invalidate its existing registration ID, as it is not guaranteed to work with the new version.
So, it not clear when the developer should invalidate or not the registration ID.
Moreover, regarding the unregister phase the new GCM API states:
Unregister the application. Calling unregister() stops any messages from the server. This is a blocking call—you shouldn't call it from the UI thread. You should rarely (if ever) need to call this method. Not only is it expensive in terms of resources, but it invalidates your registration ID, which you should never change unnecessarily. A better approach is to simply have your server stop sending messages. Only use unregister if you want to change your sender ID.
However the previous same article states:
Whenever the application registers as described in Implementing GCM Client, it should save the registration ID for future use, pass it to the 3rd-party server to complete the registration, and keep track of whether the server completed the registration. If the server fails to complete the registration, it should try again or unregister from GCM.
This is also not clear (i.e. how to handle unregistration).
Finally, based on the above, it is not clear how Canonical IDs are related to the mobile. In case Google produce a Canonical ID for an existing registration and pass it back to the application backend, it will also change the registration ID of the mobile if it calls the register method? Is there any other way for the mobile to get informed about this new ID?
Thank you very much in advance!