android - Android GCM 设备 ID 是否会更改?

标签 android google-cloud-messaging

我正在将 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/

相关文章:

android - 我的sqlite查询错了吗?

android - 为多个按钮设置相同的动画

php - Android GCM 中的通知生成问题

android - 关于2019年4月11日后GCM实现Android应用(GCM废除)

java - GCM Listener无法检索实际值

android - GoogleCloudMessaging.unregister 是否删除 token

android - 如何从 google play store 获取应用市场版本信息?

android - 如何检测android软键盘中某个键的滑动

android - Flutter CachedNetworkImage 不适用于从 playstore 下载的 App,卡在占位符上

android - Android 的可靠推送通知