【问题标题】:Send message to other devices in Google Cloud Messaging在 Google Cloud Messaging 中向其他设备发送消息
【发布时间】:2014-07-08 22:49:43
【问题描述】:

我正在从已弃用的 Google Cloud Messaging 迁移到最新版本的“Google Play 服务”。 在使用“Sender”类向其他设备发送消息之前是 gcm.jar。

示例:sender.send (msg, reg-id-device, retries);

现在我读到发送消息需要“GoogleCloudMessaging”类,并且不知道如何发送我想要的 reg-id-device。 我发现了这个:

gcm.send (SENDER_ID + "@gcm.googleapis.com", id, data);

我不知道应该把“reg-id-device”放在哪里。

【问题讨论】:

    标签: java android push-notification google-cloud-messaging google-play-services


    【解决方案1】:

    Sender 类在 gcm-server.jar 中并且未被弃用。

    已弃用的库 gcm.jar 是客户端库。 它被 Google Play Services 库的 GoogleCloudMessaging 类所取代。虽然此类有一个 send 方法,但它仅用于将设备到云的消息从设备发送到您的服务器。

    如果您不需要设备到云消息传递,您可以继续使用 Sender 类。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-09-22
      • 1970-01-01
      • 2014-02-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多