【问题标题】:Firebase notification on child added/modified添加/修改子项的 Firebase 通知
【发布时间】:2016-10-27 14:31:54
【问题描述】:

是否可以在 firebase 数据库更改时生成推送通知(如果应用不在前台)?我开始编写一个 android 应用程序。

【问题讨论】:

    标签: android firebase firebase-realtime-database firebase-cloud-messaging


    【解决方案1】:

    Firebase 提供了一个名为 Cloud Functions 的工具。

    有了这个,您可以收听您的 Firebase 数据库并发送通知,而无需外部服务器 :)

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

    【讨论】:

    • 是否需要一个火力计划来访问云功能? @瓦伦丁
    • 查看 Firebase 定价 (firebase.google.com/pricing)。您每月有 125k 次免费通话。
    • 我发现 Cloud Functions 对所有内部调用 Api 都是免费的,但是在 firebase 的 Log 部分却显示了计费消息。这只是一个警告
    【解决方案2】:

    要以简单的方式做到这一点,您可以使用服务,在此服务中,您可以在触发事件时在 firebase 数据库中的 ref 上设置侦听器,您可以创建通知并将其显示给用户。

    这是一个非常简单的教程: https://www.simplifiedcoding.net/android-push-notification-tutorial-using-firebase/

    【讨论】:

      【解决方案3】:

      当然有。只需让您的 Android 应用将通知请求写入数据库即可。

      在 Firebase 云消息传递中不支持发送设备到设备通知(请参阅 this answer),因此您需要一个服务器组件。有关如何在 nodejs 中发送推送通知的示例,请参阅this answer

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2018-02-27
        • 2018-05-04
        • 2021-11-07
        • 2016-09-24
        • 2017-12-15
        • 1970-01-01
        • 2021-12-28
        • 1970-01-01
        相关资源
        最近更新 更多