[英]How to send a message to a specific user of an FCM (Firebase Cloud Messaging) token?
The issue is that FCM
provides a token for each unique app for a device, so let's say two users use the same device and application, one signs out so that the other can sign in and use the app, i'm confused about how the flow should go! 问题在于,
FCM
为设备的每个唯一应用程序提供令牌,因此,假设有两个用户使用相同的设备和应用程序,一个用户退出以便另一个用户可以登录并使用该应用程序,我对如何流应该去! now the two users have the same token so both of them will receive the upcoming messages. 现在,这两个用户具有相同的令牌,因此他们两个都将收到即将到来的消息。
A similar question was asked here and here but it's still not clear for me! 在这里和这里都提出了类似的问题,但对我来说仍然不清楚!
Any help will be appreciated. 任何帮助将不胜感激。
Generate a user specific unique code
to each user by yourself at the time of login.send the user specific unique code
along with the push notification from server end. 登录时由您自己为每个用户生成
user specific unique code
于user specific unique code
将user specific unique code
于user specific unique code
以及来自服务器端的推送通知一起发送。
Now send push notifications to all users.and when notification receives check check the user specific unique code
to identify the user 现在向所有
user specific unique code
发送推送通知。当收到通知时,检查user specific unique code
以识别用户
When the App is killed, then by default Android
will shows the 'notification data' as Notification
, So the 'notification data' should be common to all users. 当应用被终止时,默认情况下,
Android
将显示“通知数据”为Notification
,因此“通知数据”应为所有用户所共有。
User specific data should be added as 'data message'.When a push notification arrives, the default Notification will be shown.And the 'data message' will get through the Intent
in the launcher activity.Here you can identify the user by the user specific unique code
and respond to push notification. 用户特定的数据应作为``数据消息''添加。当推送通知到达时,将显示默认的Notification。并且``数据消息''将通过启动器活动中的
Intent
获取。在此您可以通过user specific unique code
标识user specific unique code
并响应推送通知。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.