我如何知道 Firebase 云消息传递令牌已停用? [英] How can I know that a Firebase Cloud Messaging token is out of use?

查看:16
本文介绍了我如何知道 Firebase 云消息传递令牌已停用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

单个用户可以将多个设备连接到他的帐户.因此,他可以拥有多个云消息传递令牌.每次用户打开应用程序时,该设备的令牌都会发送到应用程序服务器并保存在那里.

A single user can have multiple devices connected to his account. Because of that he can have multiple cloud messaging tokens. Everytime the user opens the app the token from that device is send to the app server and saved there.

如果用户从他的一台设备上卸载该应用会怎样?我没有机会告诉服务器令牌不再使用.由于其他用户从原始用户那里获得了不再使用的令牌,我是否会通知其他用户?

What happens if a user uninstalls the app from one of his devices? I have no chance to tell the server that the token is not longer in use. Can it occure that I notify an other user instead since this other user has acquired the not longer used token from the original user?

推荐答案

如果用户从他的一台设备上卸载应用会发生什么?

通常,当您的应用被卸载时,建议您(开发者)自动确保从您自己的应用服务器中删除相应的注册令牌.

Usually, when your app is uninstalled, it is advisable for you (the developer) to automatically make sure that the corresponding registration token is deleted from your own App Server.

由于其他用户从原始用户那里获得了不再使用的令牌,我是否可以通知其他用户?

没有.每个应用程序实例的每个注册令牌都是唯一的.因此请放心,如果注册令牌因任何原因无效/过期,其他用户将无法使用它.向无效/过期的注册令牌发送消息将导致 未注册错误.

No. Each registration token is unique per each app instance. So rest assured that if a registration token is invalidated/expires for whatever reason, no other user will be able to use it. Sending a message to an invalid/expired registration token will result to a NotRegistered error.

这篇关于我如何知道 Firebase 云消息传递令牌已停用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆