GCM: How do you subscribe a device to a topic?

后端 未结 1 1343
南笙
南笙 2021-01-20 13:28

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 u

相关标签:
1条回答
  • 2021-01-20 14:21

    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.

    0 讨论(0)
提交回复
热议问题