1

How to send notification to the user in a flutter application even when the app is closed when a field in firebase database change

mo sal
  • 53
  • 1
  • 6
  • Have you looked at this [https://firebase.google.com/docs/functions/database-events#trigger_a_function] and this [https://firebase.google.com/docs/functions/use-cases#notify_users_when_something_interesting_happens] ? – srinij Aug 18 '21 at 23:06

1 Answers1

3

I would use a Cloud Function and Firebase Messaging for this.

  1. A Cloud Function is triggered (onWrite), when the user document changed
  2. The Cloud Function sends a Firebase Messaging Notification to this user.

Note: For sending the Firebase Messaging Notification you need to store the Firebase Messaging Token of the user in a database, so you can say that you want to send a notification to specific user.

Nils Reichardt
  • 3,195
  • 2
  • 18
  • 28