user4200570
user4200570

Reputation:

FIRMessaging - Limit 1 topic or check signed up topics

I looked through the documentation regarding this and couldn't find anything. Is there a way to see what topics the user is signed up for? Or a way to limit it to 1 topic?

Upvotes: 0

Views: 68

Answers (1)

Frank van Puffelen
Frank van Puffelen

Reputation: 600006

There is no method for getting the list of topics within the Firebase Cloud Messaging API. But if you're willing to run server-side code, you can use the Instance ID REST API directly:

Example GET request

https://iid.googleapis.com/iid/info/nKctODamlM4:CKrh_PC8kIb7O...clJONHoA?details=true
Authorization:key=AIzaSyZ-1u...0GBYzPu7Udno5aA

Example result

HTTP 200 OK
{
  "application":"com.iid.example",
  "authorizedEntity":"123456782354",
  "platform":"Android",
  "attestStatus":"ROOTED",
  "appSigner":"1a2bc3d4e5",
  "connectionType":"WIFI",
  "connectDate":"2015-05-12
  "rel":{
    "topics":{
      "topicname1":{"addDate":"2015-07-30"},
      "topicname2":{"addDate":"2015-07-30"},
      "topicname3":{"addDate":"2015-07-30"},
      "topicname4":{"addDate":"2015-07-30"}
    }
  }
}

Upvotes: 1

Related Questions