Is it possible to generate a push notification (if the app is not in the foreground) on firebase db changes? I started coding an android app.
3 Answers
Firebase provides a tool called Cloud Functions.
With this, you can listen to your Firebase Database and send Notifications without the need for an external server :)

- 5,379
- 7
- 36
- 50
-
1is it needed a blaze plan for accessing Cloud function? @Valentin – Federico Rizzo May 13 '18 at 13:22
-
Check the Firebase pricing (https://firebase.google.com/pricing). You have 125k calls per month for free. – Valentin May 14 '18 at 06:38
-
I found out that Cloud Functions are free for all internal call Api, but in Log section of firebase however is showed message for billing. It is only a warning – Federico Rizzo May 14 '18 at 06:39
To do it in a simple way, you can use a Service, in this Service you can set a Listener on a ref in your firebase DB when the event is triggered you can create a notify and show it to the user.
This is a very simple tutorial: https://www.simplifiedcoding.net/android-push-notification-tutorial-using-firebase/

- 4,795
- 15
- 19
There certainly is. Just have your Android app write the notification request into the database.
Sending device-to-device notifications is not a supported scenario in Firebase Cloud Messaging (see this answer), so you'll need a server component for that. For an example of how to send a push notification in nodejs, see this answer.

- 1
- 1

- 565,676
- 79
- 828
- 807