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

查看:94
本文介绍了仅向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天全站免登陆