I am using the new GCM APIs to register. The method documentation clearly states:
Register the application for GCM and return the registration identifier. You must call it once when your application is installed, and send the returned registration ID to the server.
Repeated calls of this method return the original registration ID.
However, reading this article ( http://developer.android.com/google/gcm/adv.html#reg-state ), it says that there are two cases that require special treatment:
There are also two other scenarios that require special attention:
- Application update
- Backup & Restore
When the application is updated, it should cancel the existing registration identifier, since it is not guaranteed to work with the new version.
So, it is not clear when the developer should invalidate the registration identifier.
In addition, regarding the non-registration phase, the new GCM API states:
Unregister the application. The unregister () call stops any messages from the server. This is a blocking call - you should not call it from the user interface thread. You should rarely (if ever) use this method. This is not only an expensive resource, but also invalidates your registration identifier, which you should never change unnecessarily. The best approach is to simply stop sending messages to your server. Use only deregistration if you want to change the sender ID.
However, the previous same article said:
Whenever an application is registered, as described in the "Implementing GCM" section of the Client, it must save the registration identifier for future use, pass it to a third-party server to complete the registration, and monitor whether the server has been completed. If the server does not complete the registration, try again or unregister from GCM.
It is also not clear (for example, how to handle registration).
Finally, based on the foregoing, it is not clear how canonical identifiers are associated with a mobile phone. If Google issues a Canonical ID for an existing registration and transfers it back to the backend of the application, will it also change the registration ID of the mobile phone if it calls the registration method? Is there any other way for a mobile to get information about this new ID?
Thank you in advance!