Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does a android GCM device id ever change?

I'm building GCM into my app and I want to make sure I don't end up with duplicate device ID's.

Is there a 'best practice' for dealing with device ID's? My original though was when the app loads it calls gcm.register, and posts the ID to my server, and if the key isnt in my database, I'll store it, then when I send out a notification, loop through the DB and send the messages.

But I as wondering if the ID ever changes, I don't want to send multiple messages to one device.

like image 286
TMH Avatar asked Sep 10 '13 15:09

TMH


Video Answer


1 Answers

yes it is possible for the ID to change. If you take a look at the tutorial in the SDK, every time the app is updated to a new version it will go and get a new ID because the previous ID is not guaranteed to work.

specifically take a look at this page

http://developer.android.com/google/gcm/client.html

 Check if app was updated; if so, it must clear the registration ID
 since the existing regID is not guaranteed to work with the new
 app version.
like image 153
tyczj Avatar answered Oct 01 '22 21:10

tyczj