Android 应用/设备可以调用 PubSub subscribe() 来订阅主题。
是否可以使用 GCM 的 HTTP API 订阅和取消订阅带有注册 ID 的设备?非常感谢示例或引用。
最佳答案
已编辑: 是的,正如@Asaf 提到的,您可以通过 API 调用来做到这一点: https://iid.googleapis.com/iid/v1/IID_TOKEN/rel/topics/TOPIC_NAME
这是 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.
关于android - GCM : How do you subscribe a device to a topic?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33370895/