我正在将 GCM 构建到我的应用程序中,我想确保我最终不会得到重复的设备 ID。
是否有处理设备 ID 的“最佳实践”?我最初的想法是当应用程序加载时它调用 gcm.register,并将 ID 发布到我的服务器,如果 key 不在我的数据库中,我将存储它,然后当我发出通知时,循环遍历数据库并发送消息。
但我想知道 ID 是否会更改,我不想向一台设备发送多条消息。
最佳答案
是的,ID 可以更改。如果您查看 SDK 中的教程,每次应用更新到新版本时,它都会去获取一个新 ID,因为不能保证以前的 ID 有效。
具体看一下这个页面
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.
关于android - Android GCM 设备 ID 是否会更改?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18722650/