0

If I have 2 users, is it possible for user1 to send user2 a push notification if user2's app is in the background?

The scenario is: user1 updates a field in a Firestore document. At this point, I want user1 to send a push notification to user2 notifying them of the change.

At the moment, user2 can successfully detect document changes when the app is in the foreground via document.addSnapshotListener().

However when user2 leaves the app their snapshotListener is removed.

Is there a way I can send a push notification from user1 to user2 while only using Firestore and built-in Android APIs or Firebase Cloud Messaging? Or do I have to use something like Google Cloud Functions for this to work?

Zorgan
  • 8,227
  • 23
  • 106
  • 207
  • Use xmpp for that – Pavya Jul 13 '19 at 11:26
  • I have exaplained in one of my tutorials step by step, how you can send **[notifications](https://www.youtube.com/watch?v=6RzB4HXzQyA&t=3s&list=PLn2n4GESV0AmXOWOam729bC47v0d0Ohee&index=17)** to specific users using `Cloud Firestore` and `Node.js`. You can also take a look at my answer from this **[post](https://stackoverflow.com/questions/48298993/push-notifications-on-content-change/48299840)**. – Alex Mamo Jul 13 '19 at 11:35

0 Answers0