如何为 Firebase 创建通知主题并使用它? [英] How create notification topic for Firebase and use this?
本文介绍了如何为 Firebase 创建通知主题并使用它?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我可以为单个用户和我的应用程序中的所有用户创建通知,但我无法通过创建主题了解和查找有关通知的信息.为此需要创建单独的服务,我的主题如何动态?
I can create notifications for single user and for all users in my app, but I can't understand and find information about notification with create topic. For this need create separate service and how do my topics dynamic?
推荐答案
订阅主题时无需创建服务.只需在您应用中的任意位置拨打电话:
There is no need to create a service when you want to subscribe to a topic. Just call anywhere in your app:
FirebaseMessaging.getInstance().subscribeToTopic("news");
另请参阅为客户端应用订阅主题部分 在 Firebase 文档中.
Also see the section Subscribe the client app to a topic in the Firebase documentation.
这篇关于如何为 Firebase 创建通知主题并使用它?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文