【发布时间】: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