How to get all subscribed topics? #4819
-
QuestionI use topics on my project and sometimes users tell me they have a push messages not related to user. But, what if a user clear all data (android)? What if unsubscribe processing will be terminated (or early), but user already logged out? The question is: How to know all subscribed topics in any time? I found one way to Get all subscribed topics from firebase cloud messaging from stackOverflow, but this method does not work for iOS (not tested for Android, will do it soon) So, assume it works for android then how to get the same for iOS? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 8 replies
-
I believe using this google apis endpoint https://iid.googleapis.com/iid/info/?details=true Should return a list of subscribed topics regardless of platform (iOS, android) for a particular FCM token. My suggestion would be to create some server side logic either in a cloud function or Http endpoint that hits this endpoint with your Firebase server key,
Passing in the users FCM token and topic be unsubscribed from. You can then make a request to this endpoint or cloud function when a user signs out of your application. |
Beta Was this translation helpful? Give feedback.
I believe using this google apis endpoint https://iid.googleapis.com/iid/info/?details=true
Should return a list of subscribed topics regardless of platform (iOS, android) for a particular FCM token.
My suggestion would be to create some server side logic either in a cloud function or Http endpoint that hits this endpoint with your Firebase server key,
To get a list of topics a user is subscribed to, then loops through each subscribed topic and call
admin.messaging().unsubscribeFromTopic(registrationTokens, topic)
Passing in the users FCM token and topic be unsubscribed from.
You can then make a request to this endpoint or cloud function when a user signs out of your application.