[英]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.