一台设备或一个帐户是FCM(firebase云消息)令牌吗? [英] Is FCM (firebase cloud messaging) Token for one device or for one account?

查看:150
本文介绍了一台设备或一个帐户是FCM(firebase云消息)令牌吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当用户注册到应用程序时,我想在数据库中的android应用程序用户表中存储FCM令牌。当我想发送通知给特定的用户,然后我会从相应的行获取令牌,并发送推送通知。但我很困惑,每当应用程序用户从他的应用程序注销,并注册从同一设备的新帐户,那么将有两个行,因此数据库上同一设备的两个令牌。如何处理这种情况?设备中的旧令牌发生了什么?请任何人都可以帮助我?

解决方案

用于发送FCM消息的实例ID令牌表示设备上的实例和应用程序。应用程序的当前用户不会影响表示应用程序实例的标记。卸载并重新安装应用程序将导致生成一个新的令牌,但不会在切换用户等应用程序行为。

您仍然应该删除令牌的映射到用户注销并添加一个新的映射具有相同的令牌给登录的用户,但它将是相同的标记。

I want to store FCM token in my android app user's table in database when user register to the app . 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. 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.

这篇关于一台设备或一个帐户是FCM(firebase云消息)令牌吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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