Ad

Does Firebase Cloud Messaging Allow Targeting Of Push Notifications To A Specific Device/user Etc

I am trying out firebase cloud messaging (React-native-firebase) and it seems that I am only able to push notifications to all android/ios users, not specific users. Is there a way to target a specific user. Like if a user invites another user only send notification to that one specific user?

Ad

Answer

The flow can be this one:

  • User allow notifications on their device(s)
  • Grab the generated token and store it in the user document inside a tokens array.
  • (If the same user connects to your app in another device, add the new token in the tokens array)
  • If you want to target a specific user, get his UID and send a notification to their devices.
  • You can also subscribe a user to a topic and send a notification to users subscribed to that topic.
Ad
source: stackoverflow.com
Ad