0

I would like to send a notification in every state (app in background or running) when some data in firebase are changed the database. Do I need to use push notification from firebase? I use the xxx.keepSync(true) to sync with the firebase db. May I use this detect the change and how can I send the notification in the status bar?

ng2b30
  • 351
  • 6
  • 18

1 Answers1

0

You can use firebase cloud functions. Refer to firebase documentation for details.

Nabajyoti Das
  • 454
  • 7
  • 10
  • I need to detect the change of firebase in another server or I send send a request to another server and it send a request to firebase to send the push notification? – ng2b30 Mar 11 '17 at 09:13
  • Sorry I didn't get what you said. – Nabajyoti Das Mar 11 '17 at 09:16
  • Exactly what do you want to achieve? – Nabajyoti Das Mar 11 '17 at 09:18
  • Like Facebook or instragram. When people comment on their post, the owner would get the notifications. When people post a new post, it would send the notification to all the users – ng2b30 Mar 11 '17 at 09:22
  • Such kind of implementation can be easily implemented using firebase realtime db and cloud messaging. Check out firebase documentation for more info. Visit firebase.google.com – Nabajyoti Das Mar 11 '17 at 09:32
  • but they only show how to send notification directly from firebase to phone but how can I automatically send the notification? – ng2b30 Mar 11 '17 at 09:54
  • Make a http request to https://fcm.googleapis.com/fcm/send with the required headers on the onDataChange method in firebase. For more info visit http://stackoverflow.com/questions/37435750/how-to-send-device-to-device-messages-using-firebase-cloud-messaging – Nabajyoti Das Mar 11 '17 at 10:07