Option 1 - Send messages directly from Firebase
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".
Option 2 - Send messages from the app to a service; then to Firebase
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:
- An app server (written in whatever environment you know best or is most appropriate)
- Some other trusted environment such as Cloud Functions for Firebase
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))
Option 3 - Use Upstream Messages
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.