Flutter - How to integrate automatic push notifications

Viewed 513

I have already built a chat app to practice flutter and I would really like to integrate push notifications that notify the users when a new message is sent but I don't seem to find any relevant information on the internet about this topic, I am currently using firebase. what can I do in order to achieve this functionality?

2 Answers

Since you are already using firebase, look into Firebase Cloud Messaging. You'll need to

  1. Save each user's device tokens in Cloud Firestore and Realtime Database
  2. When a message is sent/written to the database, trigger a cloud function to send a notification through Cloud Messaging.

you have to use firebase cloud messaging by you have to safe each user token id

that will be notify users for a particular event

check my repository in developer branch where I implement push notification by

using firebase cloud messaging

my repository for push notification

Related