How to get all topics list of Firebase through API?

前端 未结 4 418
暗喜
暗喜 2020-12-09 18:36

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.

相关标签:
4条回答
  • 2020-12-09 19:08

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

    0 讨论(0)
  • 2020-12-09 19:14

    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

    0 讨论(0)
  • 2020-12-09 19:17

    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.

    0 讨论(0)
  • 2020-12-09 19:19

    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

    0 讨论(0)
提交回复
热议问题