Reputation: 592
I want to broadcast notification to multiple devices instead of adding FCM token of each device. Currently, I am sending notification using Firebase cloud messaging to send a notification but in that, I have to add FCM client token for each device, but what I want is to broadcast message without collecting client device FCM Token.
Following versions are being used in my app ''' "react-native": "0.55.4", "react-native-push-notification": "^3.1.3", '''
Upvotes: 0
Views: 4010
Reputation: 2020
As originally answered by Tim you have two options.
If you don't mind changing your notification library, you can use react-native-firebase
. It covers most of the available Firebase features and is well-maintained.
Here's the setup guide for subscribing to topics
Upvotes: 0
Reputation: 10719
You have to options:
Option1:
You can create a device group and send push notifcations to a group of devices. Read more in the docs iOS device-group and Android device-group. Of course, here you need to know the id of the group.
Option2:
Create a topic, where your devices need to subscribe to. Then you can publish directly on topics. Unfortunately subscribing to topics is only supported for android when using react-native-push-notification
, see react-native-push-notification#android-only-methods
Upvotes: 2