Skip to content Skip to sidebar Skip to footer

GCM: How Do You Subscribe A Device To A Topic?

An Android app/device can call PubSub subscribe() to subscribe to a topic. Is it possible to subscribe and unsubscribe a device with its registration id to a topic using GCM's HTTP

Solution 1:

Edited: Yes, as @Asaf mentioned, you can do that via this an API call: https://iid.googleapis.com/iid/v1/IID_TOKEN/rel/topics/TOPIC_NAME

Here is the doc

Given a registration token and a supported relationship, you can create a mapping. For example, you can subscribe an app instance to a Google Cloud Messaging topic by calling the Instance ID service at this endpoint, providing the app instance's token as shown:

https://iid.googleapis.com/iid/v1/IID_TOKEN/rel/topics/TOPIC_NAME

Parameters

Authorization: key=YOUR_API_KEY. Set this parameter in the header.


Post a Comment for "GCM: How Do You Subscribe A Device To A Topic?"