gcm 的过期标记
Expiration tokens of gcm
我正在我的应用程序上实现 GCM 服务,但我有一些疑问。当用户第一次安装并打开我的应用程序时,它会给他一个令牌来接收通知,该令牌保存在我网站的数据库中。当用户决定卸载我的应用程序时,我认为令牌不再有用,所以我想知道是否有可能知道过期的令牌并将其从我的数据库中删除。
当您的应用服务器向 GCM 服务器发送消息时,试图到达您的应用已卸载的客户端,它(GCM 服务器)应该 return 一个 NotRegistered Error
。所以应用服务器应该从数据库中删除令牌。
通常(实际上取决于客户端平台)when the app is unistalled, what happens is:
- The end user uninstalls the client app.
- The app server sends a message to GCM connection server.
- The GCM connection server sends the message to the GCM client on the device.
- The GCM client on the device receives the message and detects that the client app has been uninstalled; the detection details depend on
the platform on which the client app is running.
- The GCM client on the device informs the GCM connection server that the client app was uninstalled.
- The GCM connection server marks the registration token for deletion.
- The app server sends a message to GCM.
- The GCM returns a NotRegistered error message to the app server.
- The app server should delete the registration token.
这意味着如果没有人尝试向您的客户(卸载应用程序的客户)发送消息,您将永远无法了解令牌是否仍在使用。
如果删除所有未使用的令牌对您来说很重要,恕我直言,您可以创建一条从您的 App Server 触发(例如每月一次)的测试消息来解决这个问题:这应该会引导您到达第 2 点。
我正在我的应用程序上实现 GCM 服务,但我有一些疑问。当用户第一次安装并打开我的应用程序时,它会给他一个令牌来接收通知,该令牌保存在我网站的数据库中。当用户决定卸载我的应用程序时,我认为令牌不再有用,所以我想知道是否有可能知道过期的令牌并将其从我的数据库中删除。
当您的应用服务器向 GCM 服务器发送消息时,试图到达您的应用已卸载的客户端,它(GCM 服务器)应该 return 一个 NotRegistered Error
。所以应用服务器应该从数据库中删除令牌。
通常(实际上取决于客户端平台)when the app is unistalled, what happens is:
- The end user uninstalls the client app.
- The app server sends a message to GCM connection server.
- The GCM connection server sends the message to the GCM client on the device.
- The GCM client on the device receives the message and detects that the client app has been uninstalled; the detection details depend on the platform on which the client app is running.
- The GCM client on the device informs the GCM connection server that the client app was uninstalled.
- The GCM connection server marks the registration token for deletion.
- The app server sends a message to GCM.
- The GCM returns a NotRegistered error message to the app server.
- The app server should delete the registration token.
这意味着如果没有人尝试向您的客户(卸载应用程序的客户)发送消息,您将永远无法了解令牌是否仍在使用。
如果删除所有未使用的令牌对您来说很重要,恕我直言,您可以创建一条从您的 App Server 触发(例如每月一次)的测试消息来解决这个问题:这应该会引导您到达第 2 点。