Firebase notification on child added/modified

前端 未结 3 557
死守一世寂寞
死守一世寂寞 2020-12-09 05:10

Is it possible to generate a push notification (if the app is not in the foreground) on firebase db changes? I started coding an android app.

相关标签:
3条回答
  • 2020-12-09 05:18

    There certainly is. Just have your Android app write the notification request into the database.

    Sending device-to-device notifications is not a supported scenario in Firebase Cloud Messaging (see this answer), so you'll need a server component for that. For an example of how to send a push notification in nodejs, see this answer.

    0 讨论(0)
  • 2020-12-09 05:24

    Firebase provides a tool called Cloud Functions.

    With this, you can listen to your Firebase Database and send Notifications without the need for an external server :)

    See : https://firebase.google.com/docs/functions/use-cases

    0 讨论(0)
  • 2020-12-09 05:38

    To do it in a simple way, you can use a Service, in this Service you can set a Listener on a ref in your firebase DB when the event is triggered you can create a notify and show it to the user.

    This is a very simple tutorial: https://www.simplifiedcoding.net/android-push-notification-tutorial-using-firebase/

    0 讨论(0)
自定义标题
段落格式
字体
字号
代码语言
提交回复
热议问题