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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With