How to get all topics list of Firebase through API? [duplicate]

随声附和 提交于 2019-11-29 18:29:41

问题


This question already has an answer here:

  • Get all subscribed topics from firebase cloud messaging 1 answer

I want to retrieve all the topics created so far via API request, similar to the list that firebase console display. See the image attached.


回答1:


There is no public API to get the list of topics for Firebase Cloud Messaging




回答2:


I just copy Answer from same question here becuase this page is first result in google: Get all subscribed topics from firebase cloud messaging

you can do it through a GET request

HTTP GET Request

https://iid.googleapis.com/iid/info/<TOKEN>?details=true
Content-Type:application/json
Authorization:key=AIzaSyZ-1u...0GBYzPu7Udno5aA

TOKEN in url : FirebaseInstanceId.getInstance().getToken();

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




回答3:


The way I got around this was using the firebase database, first create a topics folder inside the database, then add entries into this folder when a user creates a new topic.

You then create a function within the app to retrieve all entries in this folder within the database.

Now you can allow the user to select a pre existing topic from the results of the database and then use that to call your subscribe function.

Not a solid solution for all but worked for me.




回答4:


I too have a requirement for the exact same use case, However, I had to just make my own list in a datastore and read off of that. And not to forget that if I created a topic from code, I can't even see it until a couple of hours on the console. Hope there is an API soon to list topics and also decrease the lag in showing it on console.

So in cases where I can't really see it on console, I would have loved to see the list of topics API



来源:https://stackoverflow.com/questions/37874606/how-to-get-all-topics-list-of-firebase-through-api

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!