简体   繁体   English

是一个设备还是一个帐户的FCM(firebase云消息传递)令牌?

[英]Is FCM (firebase cloud messaging) Token for one device or for one account?

I want to store FCM token in my android app user's table in database when user register to the app . 当用户注册到应用程序时,我想在我的android app用户的数据库表中存储FCM令牌。 When i want to send notification to specific user then i will fetch Token from corresponding row and send push notification.But i am confused that whenever app user logout from his app and register new account from same device ,then there will be two row and hence two Token for same device on database. 当我想向特定用户发送通知时,我将从相应的行获取令牌并发送推送通知。但我很困惑,每当应用程序用户从他的应用程序注销并从同一设备注册新帐户,那么将有两行因此数据库上同一设备的两个令牌。 How to handle such case? 如何处理这种情况? What happen to old Token in device? 设备中的旧令牌会发生什么? please anyone can help me?? 请有人可以帮帮我吗?

The Instance ID token used to send FCM messages represents the instance of and app on a device. 用于发送FCM消息的实例ID令牌表示设备上的实例和应用程序。 The current user of the app would not affect the token that represents the app instance. 该应用的当前用户不会影响代表该应用实例的令牌。 Uninstalling and reinstalling the app would cause a new token to be generated but not for in app behaviour like switching users. 卸载并重新安装应用程序将导致生成新令牌,但不会导致应用程序行为(如切换用户)。

You should still remove the mapping of the token to the user on logout and add a new mapping with the same token to the user that logs in but it will be the same token. 您仍应在注销时删除令牌到用户的映射,并将具有相同令牌的新映射添加到登录的用户,但它将是相同的令牌。

I probably feel this may help you, 我可能觉得这对你有帮助,

When user logs out clear his device token and make him Logout so that he won't be able to receive the updates and hence only one user at a time can get the updates 当用户注销时清除他的设备令牌并让他退出,这样他就无法接收更新,因此一次只有一个用户可以获得更新

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Firebase云消息传递(FCM)不止一行 - Firebase Cloud Messaging (FCM) more than one line Firebase 云消息传递:FCM 令牌到期 - Firebase Cloud Messaging : Expiration of FCM token Android Firebase 云消息传递令牌 (FCM) 令牌太短/不完整 - Android Firebase Cloud Messaging Token (FCM) token is too short/incomplete 在FCM(Firebase云消息传递)中,在通知中包含令牌是否安全? - In FCM (Firebase cloud messaging), is it safe to include token in the notification? Firebase Cloud Messaging(FCM)注册令牌服务器端验证 - Firebase Cloud Messaging (FCM) registration token server-side validation 如何向FCM(Firebase云消息传递)令牌的特定用户发送消息? - How to send a message to a specific user of an FCM (Firebase Cloud Messaging) token? FCM(Firebase云消息传递)发送到多个设备组 - FCM (Firebase Cloud Messaging) send to multiple device group 使用FCM(Firebase Cloud Messaging)是否需要注意任何限制,规定或任何其他国际化问题? - Are there any restriction(s), regulations or any other internationalization issues using FCM (Firebase Cloud Messaging) that one should be aware of? Android,FireBase 云消息传递,(FCM) - Android, FireBase Cloud Messaging, (FCM) 在一个功能上发送多个firebase云消息 - Send multiple firebase cloud messaging on one functions
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM