仅向 Firebase 中的一位用户发送通知 [英] Send notification to only one user in firebase

查看:11
本文介绍了仅向 Firebase 中的一位用户发送通知的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 android 应用程序,我想在数据更改时只向一位用户发送通知.我怎样才能做到这一点.谁能提供一个代码片段,我可以放入 OnDataChange() 方法以向特定用户发送通知.由于在 Firebase 中,身份验证后将为每个用户创建一个唯一的用户 ID,有没有办法将通知发送给特定用户或仅发送给使用该用户 ID 的一组用户.

I have an android app and I want to send notifications to only one user when data is change. How can I do that. Could anyone give a code snippet that I can put in OnDataChange() Method to send notification to a specific user. Since In Firebase there will be an unique user id created to every user after authentication, Is there any way to send the notification to a particular user or only to a group of Users using that userid.

推荐答案

您可以为该用户创建主题并订阅该主题,然后 Firebase 允许我们使用主题消息向特定主题发送消息.请看这个链接

You can make topic for this user and subscribe to that topic then Firebase allow us to send message to specific topic using topic message. Kindly Look at this link

https://firebase.google.com/docs/cloud-消息传递/android/topic-messaging

还有这个

如何使用 FCM 向特定用户发送通知?

希望它会有所帮助.

这篇关于仅向 Firebase 中的一位用户发送通知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆