android - 如何启动 android GCM token 刷新?

标签 android google-cloud-messaging

根据 docs ,

To protect the client app and app server from potential malicious re-use of registration tokens, you should periodically initiate token refresh from the server. When GCM registration token refresh is initiated from server side, the client app must handle a tokenRefreshed message with the GCM registration client/server handshake.

启动 gcm 注册 token 刷新的步骤是否记录在某处?

我知道 InstanceIDListenerServiceonTokenRefresh。这些用于创建新 token 并将其更新到您的应用服务器。但具体如何做以下位呢?

periodically initiate token refresh from the server

最佳答案

执行此操作的最佳方法是在服务器上安排一个作业,每隔几个月(GCM 建议 6 个月)发送一次带有 ACTION REFRESH_TOKEN 的通知。在客户端应用程序的消息回调中,切换 ACTION 并处理刷新 token 。


旧答案

你看过这个页面吗:https://developers.google.com/instance-id/guides/android-implementation#refresh_tokens

The Instance ID service initiates callbacks periodically (for example, every 6 months), requesting that your app refreshes its tokens. It may also initiate callbacks when:

  • There are security issues; for example, SSL or platform issues.
  • Device information is no longer valid; for example, backup and restore.
  • The Instance ID service is otherwise affected.

关于android - 如何启动 android GCM token 刷新?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32167533/

相关文章:

android - React-Native:新项目的空白屏幕

android - 我如何在单个 TextView 中逐行设置文本对齐方式

Android SQLite 多表数据库开发

android - 无法解析 com.google.firebase :firebase-core:10. 0.1

firebase - 在哪里可以找到 Firebase 云消息传递的 API key ?

java - Android - 是否可以在指定位置将图像插入到另一个图像中?

android - 如何从库中删除未使用的资源?

ios - 适用于iOS应用的GCM(Google云消息传递)

java - Google App Engine Java 和 Android 入门

android - 如何从 ADB 向设备发送 FCM(firebase 云消息传递)推送通知