Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

FCM (Firebase Cloud Messaging) how to send to all Phones?

I have created a small App that's able to receive Push Notifications from the FCM Console.

What i want to do now is to send a Push-Notifications to all Android Phones that got the app Installed using the API. And this is where i got completely lost. Is there no way to send it to all Phones without collecting all the registration-ids? Does this only work with the Console but not with the API?

thanx in advance

like image 614
mholzer78 Avatar asked Jun 04 '16 20:06

mholzer78


People also ask

How do I send a FCM data message?

For sending FCM notification payload you can use Firebase Cloud Messaging Tool in firebase console. And click on Send your first message. Then enter the Title and body field. If you wish to send it to a particular device then click on Send test message and enter the FCM registration token.


1 Answers

Sending a message to all the phones like what you do from the Firebase Web Console is only possible from the Web Console. If you need this feature from the API you can submit a feature request: https://firebase.google.com/support/contact/bugs-features/

Another possibility is to have all the client registering to a specific topic via FirebaseMessaging.getInstance().subscribeToTopic(topicName)

In this way you can send a message to the whole topic without collecting the registration-ids manually.

like image 164
Diego Giorgini Avatar answered Oct 12 '22 00:10

Diego Giorgini