0

i am making a chating app using flutter and firebase.i'm trying to get background notification whenever a new message comes but how do i listen to changes in firebase and send a notification about it when the app is closed or runing in background. it works when app is in foreground but not in idle or closed condition.

can i run background task for that? if yes, how?

NOTE: i dodn't have a paid firebase account so i can't use cloud function.

if anyone has answer to it i will realy apreciate it because i am unable to find it's answer on google or youtube.

i found this video on youtube

Yash Sahu
  • 1
  • 2
  • There is no guaranteed way to always listen for updates on the device itself, so you will need to instead listen elsewhere, in a place where you *can* guarantee you can always listen, and then use Firebase Cloud Messaging to notify the device. You don't *have* to use Cloud Functions for this listener, but you will need to run some service on a device that can always be active. – Frank van Puffelen Nov 26 '22 at 15:08
  • But how can i automate cloud message without using cloud function and what i havee to run in background can you elaborate please? – Yash Sahu Nov 27 '22 at 17:45
  • You can call Cloud Functions from whatever device you have that is always active, through its API. I recommend reading the [docs](https://firebase.google.com/docs/cloud-messaging/) and giving it a try, e.g. like this: https://stackoverflow.com/questions/37371990/how-can-i-send-a-firebase-cloud-messaging-notification-without-use-the-firebase – Frank van Puffelen Nov 27 '22 at 21:28

0 Answers0