Get All Subscribed Topics from Firebase Cloud Messaging

Get all subscribed topics from firebase cloud messaging

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.

However, 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=AAA....i1nM:APA9.....81gTPXCE55....JLPEG0wZobG_ile8lI35JTzHYE5MC..BmDD_Cxj5OxB1Yh....Rs5lo3UwLNL9h-WcocGV....b5bYWNI55kzNsrHK-7GljUDtMn

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

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

Note: Be careful when finding key, dont use web api key its different.

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

scope is usually "FCM"

Firebase: Get list of users subscribed to a topic

There is no API to get a list of the tokens that are subscribed to a specific topic.

See:

  • Count subscribers of a topic in Firebase Cloud Messaging
  • How to know whether a user has subscribed to a topic in FCM?
  • List of clients who have registered for a topic in FCM

Android/Firebase - Check to see if you are subscribed to topic

There is currently no way to check on the client side if they are subscribed to a topic.

The behavior for subscribeToTopic is it would immediately subscribe to the specified topic, if it fails, it would retry on it's own (unless your app was killed). See my answer here.

I think that forcing the onTokenRefresh call just to make sure that subscribeToTopic is too much. You could simply just call it in your initial activity if you want, that way, everytime the app starts, it sends the subscription request.

How to get all topics list of Firebase through API?

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

Firebase Cloud Messaging topic is ignored, all users keep getting the notification

OK, found out what's happening : The test button doesn't take the topic in consideration. So the solution is simple : just publish the notification and try in real life, it will work !

FCM, How to make all users in group to subscribe to topic

There is no API to get the current subscribers to a topic, nor is there an API that verbatim subscribes all subscribers to one topic to another topic.

If you already track group membership yourself, you can either let each client subscriber themselves to the additional topic, or you can determine the list of tokens for the group members and then subscribe them to the topic on the server.

Is there anyway to access the Firebase Topics a user is subscribed to?

FCM topic subscriptions are based on an application's Instance ID, so when you subscribe or unsubscribe to or from a topic the IID is used.

You can use the Instance ID API to get information about a particular IID, this information includes the topics that the IID is currently subscribed to. See the reference

Not all subscribed iOS devices to topic receive data notification, most often none at all. Notification without data works as expected

Turns out the data payload was exceeding the 4KB APNs limit but since when you send by topic it doesn't show any errors at all I had no way of knowing. So yeah, add this to your checklist



Related Topics



Leave a reply



Submit