What is the best way to send push notification to all of my users in Android. I have Firebase and now I'm using their backend website, but I want to do it by php or something.
There is no way to send notifications to all users except using Firebase Console, see image:
However if you are planning to do it by your own curl requests, then you should have planned it earlier. To do so you have to save the registration tokens of all users on your server. As of now, Firebase neither provide you the list of all registered tokens nor a way to send a push message to all users.
Curl request to send notification to multiple users, it will be delivered directly in onMessageReceived() method.
https://fcm.googleapis.com/fcm/send
Content-Type:application/json
Authorization:key=AIzaSyZ-1u...0GBYzPu7Udno5aA
{ "data": {
"score": "5x1",
"time": "15:10"
},
"registration_ids" : [
"bk3RNwTe3H0:CI2k_HHwgIpoDKCIZvvDMExUdFQ3P1...",
"bk3RNH0adsf:CI2k_HadfasdoDKCIZvvDMExUdFQ3P1..."
]
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With