How to know whether a user has subscribed to a top

2019-05-10 14:46发布

问题:

How to know wether we have already subscriped to a topic in Firebase Cloud Messaging?

回答1:

You can get token

String token = FirebaseInstanceID.getToken();
Log.d(TAG,token);

and do a Get to https://iid.googleapis.com/iid/info/token

If using curl

curl -X Get -H"Authorization:key=serverAPIkey" "https://iid.googleapis.com/iid/info/token?details=true"

to see all of the device's subscribed topics

Find out details about a client app instance's subscriptions, including each topic name and subscribe date. See get information about app instances