4

According to http://developer.android.com/google/gcm/client.html#sample-register the registration Id changed when I send update for my app and the user update it ...

  1. Does the registration id changed also when the user uninstall the app and then reinstall it again, if he install the same version as before ?
  2. Should I check if the user update the app every time he enter it, if yes the app send the new registration id to the server.
  3. is there any unique constant id for every device that I can get and send to my server ?

THANK YOU

Community
  • 1
  • 1
user3516596
  • 339
  • 5
  • 14

1 Answers1

5

THe registration ID doesn't necessarily change when a new version of the app is installed. Google recommend to re-register to GCM when launching the app after a new version is installed to overcome a bug that might cause the device to get unregistered if a GCM message arrives while the new version is installed.

  1. When you uninstall the app and install it again, the registration ID might change, but not necessarily. The case I found in which it changes is as follows : after the app is uninstalled, the server sends some GCM messages to the device until it receives a NotRegistered error. Then, when you reinstall the app, you'll get a new registration ID.

  2. Yes, that's what you should do. You can see a code sample doing exactly that in the client demo.

  3. You can generate your own ID and store it in external storage, in order for it to survive past the uninstallation of the app.

See also this answer.

Community
  • 1
  • 1
Eran
  • 387,369
  • 54
  • 702
  • 768
  • 1
    is it good, to check if the user update the app and then generate another registration id, in a class the extends the application class ! – user3376321 May 07 '14 at 10:41