Want to know how FCM works in below scenarios

↘锁芯ラ 提交于 2020-11-29 03:48:25

问题


I want to know how FCM Notifications works in below scenarios:

  1. Same user logging into multiple devices. Will all the devices gets the notification?

  2. What if user uninstalls the app? Does FCM sends the notification even if user uninstalls the device, and later checks for sending failed event?

  3. If login changes on the device - Suppose if I login to a device as user A, and then logged out of the device and logged in as user B. I must not get the notifications for user A. How this situation is handled in FCM?


回答1:


Same user logging into multiple devices - Will all the devices gets the notification?

Firebase Cloud Messaging sends messages to devices, it doesn't know anything about users. If you're sending messages to FCM Instance IDs, the message will only be delivered to the device with that ID. If you're sending messages to topics, the message will only be delivered to devices that subscribed to that topic.

Does FCM sends the notification even if user uninstalls the [app from the device]?

When the app is uninstalled, the Instance ID for that app installation is deleted to. So no message will be delivered to the app on that device anymore.

If the user later reinstalls the app on the device, it generates a new Instance ID. So it won't receive any messages from when the app was uninstalled.

If login changes on the device - Suppose if I login to a device as user A, and then logged out of the device and logged in as user B. I must not get the notifications for user A. How this situation is handled in fCm?

Since Firebase Cloud Messaging doesn't know anything about the users of your app, it is up to your application code to make this connection. Many apps clear the Instance ID from the device when a user explicitly signs out.

Also see:

  • How to refresh FCM Token on user Logout?
  • Firebase Cloud Messaging - Handling logout
  • How to unsubscribe from FCM notifications after logout from app?
  • How to release Firebase Cloud Messaging token when Android user logs out?


来源:https://stackoverflow.com/questions/56619598/want-to-know-how-fcm-works-in-below-scenarios

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!