如何启动 android GCM 令牌刷新?
How to initiate an android GCM token refresh?
根据 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 注册令牌刷新的步骤是否记录在某处?
我知道 InstanceIDListenerService
和 onTokenRefresh
。这些用于创建新令牌并将其更新到您的应用服务器。但是下面的位具体怎么做呢?
periodically initiate token refresh from the server
执行此操作的最佳方法是在服务器上安排一个作业,每隔几个月发送一次带有 ACTION
REFRESH_TOKEN
的通知(GCM 建议 6 个月)。在客户端应用程序中,在您的消息回调中,switch
在 ACTION
上并处理刷新令牌。
旧答案
你看过这个页面吗: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.
根据 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 注册令牌刷新的步骤是否记录在某处?
我知道 InstanceIDListenerService
和 onTokenRefresh
。这些用于创建新令牌并将其更新到您的应用服务器。但是下面的位具体怎么做呢?
periodically initiate token refresh from the server
执行此操作的最佳方法是在服务器上安排一个作业,每隔几个月发送一次带有 ACTION
REFRESH_TOKEN
的通知(GCM 建议 6 个月)。在客户端应用程序中,在您的消息回调中,switch
在 ACTION
上并处理刷新令牌。
旧答案
你看过这个页面吗: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.