从Firebase云消息传递中获取所有订阅的主题 [英] Get all subscribed topics from firebase cloud messaging
问题描述
使用新的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
网址中的
令牌:FirebaseInstanceId.getInstance().getToken(senderId, scope);
键:可以在 firebase控制台中找到:您的项目->设置->项目设置->云消息传递->服务器密钥
key : can be found in firebase console: Your project -> settings -> Project settings -> Cloud messaging -> Server Key
注意:查找密钥时要小心,不要使用与Web api密钥不同的密钥.
senderId
可以在设置"->中找到.云消息传递->发件人ID
senderId
can be found in Settings -> Cloud Messaging -> Sender ID
scope
通常是"FCM"
这篇关于从Firebase云消息传递中获取所有订阅的主题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!