简体   繁体   中英

How to send the Group Notifications using Firebase Cloud messaging?

I am trying to develop the Messenger App like Whatsapp using Firebase.

I'm already done the code for device to device notifications and now I am trying to send the notifications to specified group.

Please provide the example code for the Group Notifications.

There are a few ways to send messages to groups of users:

  1. Send the message to a topic that all users subscribe to . This is the simplest scenario, since you don't need to keep a list of tokens. But you have less control over the actual people that receive the message, as anyone who knows a topic can subscribe to it.
  2. Keep a list of device tokens for each group in your app server, and then send to each individual device in the group .

    You can also use the previous version of the API to send to batches of up to 500 tokens at a time . This sort of multicast delivery is not yet possible in the new API.

    For an example of this, see the documentation of Cloud Functions and the sample repo .

  3. Send to a device group with the legacy API . I'd only recommend this approach if the devices are actually owned by one user, which is the case that device groups are meant for.

Try this link

Don't forget this line Authentication:

key=<Your_API_Key> 

The word (key) is important

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM