【问题标题】:How long C2DM message is valid?C2DM 消息的有效期是多久?
【发布时间】:2023-03-30 19:00:01
【问题描述】:

我是 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);
}

我正在关注this C2DM 实施教程。

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

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

【问题讨论】:

    标签: android message android-c2dm duration


    【解决方案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 值将被发送。可选。

    根据how to set valid time period for android c2dm message?

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

    • 您的 Android 应用一直在接收 C2DM 消息,但在此期间 某些时候你会酌情忽略/处理。

    因为这个link 用于推送看起来第三方应用程序

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

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-10-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-07-20
      相关资源
      最近更新 更多