当Firebase数据库更新时,如何接收到Android用户的通知? [英] How to receive a notification to android user, when ever firebase database is updated?
问题描述
我有一个与firebase
连接的android应用程序.每当有新的孩子添加到数据库时,我都需要通过通知消息通知用户.此外,在我的应用程序中,用户选择一个代码(例如:71000,00100,90288),并且该代码存储在共享首选项中.我需要在添加或修改孩子时通知用户,仅作为用户选择的代码.非常感谢您的帮助.非常感谢.
I have an android application connected with firebase
. When ever a new child is added to the database I need the user to be notified via a notification message. Moreover, in my application the user selects a code (eg: 71000,00100,90288) and this code is stored in shared preferences. I need the user to be notified when ever a child is added or modified, only as the code selected by the user. Any help, highly appreciated.Thank you so much in advance.
推荐答案
如果您的服务器端是firebase,要在添加child时发送通知,则需要创建一个firebase cloud函数来做到这一点 所以这就是你要做的:
if your server side is firebase ,to send notification when child added , you need to create a firebase cloud function which will do that so this what you will do :
- 创建Firebase云功能
- 使用通知发送数据(使用有效负载)
- 在您的服务(邮件列表器)中接收到数据后,检查数据(数字)是否等于共享首选项中保存的一些数字
这篇关于当Firebase数据库更新时,如何接收到Android用户的通知?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!