I am using firebase realtime database in my app and i want to send fixed notifications automatically when there is a changed in realtime database but firebase cloud messaging only offers manual sending of notifications which does not meet the real-time monitoring objective of my app.
Question posted in Android Studio
The official documentation can be found here.
The official documentation can be found here.
2
Answers
Okay that’s the problem I was facing while making my Chat app.
There are two ways to send real-time notification using FCM (Firebase Cloud Messaging).
1.Through firebase console.
2.Using API provided by firebase for FCM.
Read about the API below:
1.https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages
2.https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages/send
So when there is a change in data realtime DB of Firebase you should make a post request to the given API,and the API automatically send notification to the respective person with a particular FCM token.
For step by step implementation,read the medium article below .
https://selvaganesh93.medium.com/firebase-cloud-messaging-important-rest-apis-be79260022b5
This can be implemented using FCM. By simply sending POST requests with some parameters from your server.
Here is the documentation: https://firebase.google.com/docs/cloud-messaging/server