android - 如何处理 GCM 更改注册 ID?

标签 android android-c2dm google-cloud-messaging

我想知道如果 GCM 服务器决定刷新应用程序先前从 GCM 服务器检索到的 registrationId,将如何通知应用程序/设备。 目前,我保存第一个检索到的 registrationId 并将其保存在数据库中,并将此 registrationId 发送到 App 服务器。因此,从下一次开始,App 将不会与 GCM 服务器通信。 在这种情况下,应用程序永远不会知道 GCM 服务器是否更改了 registrationId。谷歌文档建议处理此案,但未提及应采取哪些步骤。 引自谷歌 -

Although the com.google.android.c2dm.intent.REGISTRATION intent is typically received after a request was made by the application, Google may periodically refresh the registration ID. So the application must be prepared to handle it at any time.

任何建议都会有帮助,

谢谢, 库存单位

最佳答案

旧的 reg id 继续工作一段时间,但 Google 发送了一个新的 reg id 以供将来在响应的 canonical_id 字段中使用。

关于android - 如何处理 GCM 更改注册 ID?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13689530/

相关文章:

java - 棕地 |听诊器 | ":com.facebook.stetho:stetho-okhttp:1.2.0' 依赖于一个或多个 Android 库但是是一个 jar”

php - Chrome 403 禁止错误的 GCM

php - 在 GCM 中未收到推送通知

android - 未设置 "ArrayAdapter"

android - opencv C++ 从 android NV21 图像数据缓冲区创建 Mat 对象

javascript - 将多个表合并到一个数据库 SQLite

android - 将推送通知接收到库项目中(lib 项目中的 Android C2DM)

android - 如何使用不同大小写的包名称将 Android 应用程序更新部署到市场

android - 收到 GCM 通知时启动应用程序

android - 推送通知的最低 Google Play 服务版本