I want to develop a new feature in my app which lets me send notifications to all users with that app installed. I have been searching and found information on how to send upstream messages to Firebase Cloud Messaging, but found nothing explaining how to directly send notifications to other users.
There is a way to do that. You could accomplish that using Firebase database, Cloud Messaging and Node.js. You can find how to do that in this article: https://firebase.googleblog.com/2016/08/sending-notifications-between-android.html
But if you see this as too much complicated you can use some another providers like OneSignal
or Back4app
which is based on parse platform and pretty much simpler then this example above and also has a free plain. How to setup notifications using Cloud code in Back4app take a look on this example:
https://docs.back4app.com/docs/android/push-notification/push-cloud-code/
If you are trying to send out messages to all users of your Android app using Firebase, you should look at the documentation on how to "Send Messages with the Firebase Console".
If you are trying to send a message from your Android app to Firebase and then from firebase to other users, you may be missing a key component of your stack/infrastructure, a web service. The service acts as a middle man between Firebase Cloud Messaging and your app, effectively making the decisions on how to handle messages from the app, and how to send commands to firebase, including who (which devices) to target. You have options for this kind of service:
Take a look at the documentation on interacting with the Firebase Cloud Messaging Server for more details.
Once you have that set up, your flow looks more like this:
Android App (Message Sender) -> Message Handling Service -> Firebase Cloud Messaging -> Android App (Targeted Device(s))
Upstream messages still use a separate app server to handle messages sent by the device. In this case, the app sends an upstream message through FCM to the service, the service then does something with that upstream message and sends back an ACK (acknowledgment) message back to the sending device, so it can handle it with a callback. The app service, when handling the upstream message, could then command firebase to send out push notifications to targeted devices.
Overall, it's likely you have some more steps to complete.
You can also find more directly on the Firebase Cloud Messaging page or in the youtube video giving a general background to FCM.
There's also a video demoing upstream and downstream messages using firebase on youtube called Upstream and Downstream messages using FCM - Android.
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