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

标签 android google-cloud-messaging

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/

相关文章:

android - 我的 Android 小部件被杀死, "No longer want bellander.andro...."

Android facebook SDK - 无法为 facebook sharebutton 设置 onclicklistener

android - 永远不会调用 Google InAppBilling onPurchaseStateChange

android - Firebase 数据检索

ios - FIRInstanceID 在 FIRInstanceIDAPNSTokenType.Sandbox 中为零

android - 什么是 HandlerLeak?

android - 不能使用 GCMRegistrar?

ios - QT iOS 谷歌云消息崩溃

google-app-engine - 在项目中添加自定义域成员作为所有者 - GAE

Android:推送通知点击后打开外部浏览器