0

我是 android 开发新手,现在我正在为 android 设备实现 C2DM。我已经使用下面的代码来获取设备的注册 ID。

public void register(View view) {
    Intent intent = new Intent("com.google.android.c2dm.intent.REGISTER");
    intent.putExtra("app",PendingIntent.getBroadcast(this, 0, new Intent(), 0));
    intent.putExtra("sender", "youruser@gmail.com");
    startService(intent);
}

我正在关注教程以进行 C2DM 实施。

现在我的问题是设备是否关闭了更长的时间(例如 15 天),所以我想知道 C2DM 消息的有效期是多久?

如果之后设备开机并且应用服务器没有发送下一条 C2DM 消息,那么设备会收到该 C2DM 消息吗?

4

1 回答 1

1

根据http://www.hightechno.info/2011/08/c2dm-tutorial-send-push-notifications.html

在同一个查询中,另一个属性很有趣:collapse_key. 该密钥是赋予类似性质的消息的标识符。因此,if the phone is switched off and that several messages with the same identifier C2DM accumulate on the server, only the latter will be sent when the appliance is turned on。因此有必要仔细选择这些标识符。. .

delay_while_idle
  • 如果包含,则表示如果设备空闲,则不应立即发送消息。服务器将等待设备变为活动状态,然后仅发送每个 collapse_key 值的最后一条消息。选修的。

根据如何设置 android c2dm 消息的有效时间段?

  • 我们的服务器应用程序仅在特定时间发送消息

    或者

  • 您的 Android 应用程序一直接收 C2DM 消息,但在某些时候您会视情况忽略/处理。

因为这个用于推送的链接看起来是第三方应用程序

如果您的手机已连接到 Internet,那么它将立即收到来自 Pushover 服务器的通知。如果没有,它将在您连接之前保留 30 天。

您的通知是安全的,因为所有传输都是加密的。

于 2012-06-24T06:11:56.647 回答