从 firebase 云消息传递中获取所有订阅的主题 [英] Get all subscribed topics from firebase cloud messaging

查看:29
本文介绍了从 firebase 云消息传递中获取所有订阅的主题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用新的 FirebaseMessaging,可以通过以下方式轻松取消/订阅主题:

Using the new FirebaseMessaging it's easy to un/subscribe to topics via:

FirebaseMessaging.getInstance().subscribeToTopic();
FirebaseMessaging.getInstance().unsubscribeFromTopic();

但是有没有办法获取当前安装订阅的所有主题?

But is there any way to get all topics the current installation is subscribed to ?

推荐答案

我搜索了 Android API,在 SO 上问了同样的问题,但没有找到任何东西.Android API 中没有任何内容可以获取特定令牌的所有主题.

I have searched Android API, asked questions for the same on SO but din't find anything. There is nothing in Android API to get all topics of a specific token.

https://iid.googleapis.com/iid/info/<TOKEN>?details=true
Content-Type:application/json
Authorization:key=AAA....i1nM:APA9.....81gTPXCE55....JLPEG0wZobG_ile8lI35JTzHYE5MC..BmDD_Cxj5OxB1Yh....Rs5lo3UwLNL9h-WcocGV....b5bYWNI55kzNsrHK-7GljUDtMn 

TOKEN in url : FirebaseInstanceId.getInstance().getToken(senderId, scope);

key:可以在 firebase 控制台中找到:您的项目 ->设置->项目设置->云消息传递->服务器密钥

key : can be found in firebase console: Your project -> settings -> Project settings -> Cloud messaging -> Server Key

注意:找key时要小心,不要使用不同的web api key.

senderId可以在设置->中找到云消息传递->发件人 ID

senderId can be found in Settings -> Cloud Messaging -> Sender ID

scope 通常是 FCM"

这篇关于从 firebase 云消息传递中获取所有订阅的主题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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