Grégori Machado Grégori Machado - 21 days ago 8
Android Question

How to send push notification Firebase direct from app by code

I want to send a push notification when an event happens in my app, without using the Firebase console for this.
Can I send a request by json to the server? And if so, how? Because I have difficulties in this part.

Thank you

Answer

You can send upstream messages from your app to Firebase Cloud Messaging. But you will need your own app server to respond to those messages. I recommend reading the documentation on the role of these servers.

Since you cannot send direct device-to-device messages with Firebase Cloud Messaging, an alternative for some developers is to use the Firebase Database for keeping a queue of the messages. You'll still need an app server to read that queue and send the downstream messages to the devices, but at least you won't have to learn XMPP.