android - android gcm token 什么时候过期

标签 android google-cloud-messaging push token

我很好奇 android Gcm Token Expire 策​​略。 当我希望注册了 Gcm 服务的设备能够接收 Gcm 推送消息时,我将使用 API 注册它。

然后我将获得一个 Gcm token “A”。 如果我从不在 Play 商店升级我的应用程序版本代码。 谷歌会用“B”刷新它并自动使“A”过期吗?

如果是,什么时候做。 我看过一些文章说,一旦“A”被“B”刷新,那么当服务器尝试向“A”发送消息时,服务器将获得新的注册 ID“B”。我现在想知道客户端如何知道 gcm token “A”已过期并被替换为“B”

有人能回答我的问题吗?

谢谢

最佳答案

是的,实现onTokenRefresh()与文档

Called when the system determines that the tokens need to be refreshed. The application should call getToken() and send the tokens to all application servers. This will not be called very frequently, it is needed for key rotation and to handle special cases. The system will throttle the refresh event across all devices to avoid overloading application servers with token updates.

关于android - android gcm token 什么时候过期,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30024729/

相关文章:

android - 如何在 Android TV 上显示数字软件键盘?

java - Android Studio问题; java.lang.IllegalStateException : Could not execute method for android:onClick

android - 如何使用 ViewPager 在开头启动任何 fragment

iOS 和谷歌云消息 : Missing push notifications in series of notifications

android - 对 GCM token 更新过程感到困惑

iphone - 推送通知在生产环境中不起作用

push - Libgit2sharp如何进行镜像推送

android - Android 中 Jersey 2.4.1 客户端的 NoClassDefFoundError

android - 内部错误 : retry receiver class not set yet

ios - 在 iOS Swift 4 中重置 FCM 角标(Badge)计数