I register in GCM with GoogleCloudMessaging.getInstance(context); and save received token on device. Then send it to server and it\'s associated with user account. If I uni
I experienced registration ID changes when uninstalling the application, attempting to send messages to the app while it's uninstalled (until I get a NotRegistered
error) and then installing again.
Costin Manolache from Google suggests to handle registration ID changes this way :
The suggestion/workaround is to generate your own random identifier, saved as a shared preference for example. On each app upgrade you can upload the identifier and the potentially new registration ID. This may also help tracking and debugging the upgrade and registration changes on server side.
Of course, this only works when the app remains installed (since shared preferences are deleted with the app). However, if the device has external storage, you can store your identifier there, and when the app is installed again, load the stored identifier from the external storage. That way you will know the new Registration ID and the old Registration ID belong to the same device.
In addition, you should handle canonical registration ID responses from Google in your server, as mentioned in the other answer.