如何为Firebase创建通知主题并使用它? [英] How create notification topic for Firebase and use this?

查看:166
本文介绍了如何为Firebase创建通知主题并使用它?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以为单个用户和我的应用程序中的所有用户创建通知,但是我无法通过创建主题了解和查找有关通知的信息。
对于这个需要创建单独的服务,我的主题如何动态?
解决方案

没有必要创建一个服务当你想订阅一个主题。只需要在你的应用程序的任何地方调用:

  FirebaseMessaging.getInstance()。subscribeToTopic(news); 

另请参阅


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");

Also see the section Subscribe the client app to a topic in the Firebase documentation.

这篇关于如何为Firebase创建通知主题并使用它?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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