【问题标题】:Use Firebase Hosting for Notifications使用 Firebase 托管通知
【发布时间】:2017-09-22 16:08:17
【问题描述】:

我是 Firebase 托管和云消息传递的新手,但我认为这可以解决我的通知问题。目前,我的 Android 'book'-应用程序使用侦听器来检查是否添加了新书或相应用户的有趣书籍的状态是否已更改。此外,听众实际上会检查是否有新的聊天消息用于借出的书。由于下载量的关系,我现在想更改它! 我的数据库结构如下所示:

/ 
+ chats
    + 123abc    // id of a book
        + 456def    // id of a message
            - messagetext: "Hello!"
            - messagetime:1502569166935
            - messageuserid: 789ghi
        + 654fed    // id of another message
            - messagetext....


+ books
    + 123abc    // id of a book (for this book is the message above)
        - bookname: "Firebase Tutorial"
        - uid: "321uvw"    // this user is interested in the book
        - status: "yes"

当他感兴趣的书的聊天消息是新的时,如何实现将通知发送给相应的用户?当新书被创建或现有书的状态发生变化时,我如何通知用户他的用户 ID(“uid”)被使用? 我希望你可以帮助我!提前致谢!

【问题讨论】:

  • 你有任何现有的代码可以分享吗?

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


【解决方案1】:

您应该查看 Firebase Cloud Functions。使用它们,您可以在您感兴趣的节点上附加一个用于写入/更新/等的侦听器。然后以任何您想要的方式触发通知以响应触发器。见:https://firebase.google.com/docs/functions/

【讨论】:

    猜你喜欢
    • 2017-05-18
    • 2019-04-19
    • 2018-02-24
    • 1970-01-01
    • 2020-10-26
    • 2020-06-17
    • 2018-07-30
    • 2015-12-07
    • 2018-08-19
    相关资源
    最近更新 更多