【问题标题】:GCM message is not received on broken network about 15-30 minute断网约 15-30 分钟未收到 GCM 消息
【发布时间】:2017-10-06 01:20:19
【问题描述】:
  1. 将我的 Android 设备连接到 WIFI AP。
  2. 从 AP 上拔下 WLAN 电缆,然后重新连接。
  3. 尝试向我的设备发送 GCM 消息,但消息未到达。
  4. 15-30 分钟后,GCM 消息到达。

我认为 GCM 服务每次都会尝试在 15-30 分钟内向服务器发送刷新消息。因此在此期间,网络中断的 GCM 服务无法从服务器接收任何 GCM 消息,直到连接恢复。

我已经在 FCM 上测试过这个问题,但结果是一样的。

在 iOS(我的意思是 APNS)上,它在相同的情况下运行良好。

有没有什么好的解决方案可以让这种延迟在 Android 设备上排序?

【问题讨论】:

    标签: android google-cloud-messaging


    【解决方案1】:

    这是因为服务器的心跳问题,你可以强行将心跳发送到你想要的地方

    context.sendBroadcast(new Intent("com.google.android.intent.action.GTALK_HEARTBEAT"));
    context.sendBroadcast(new Intent("com.google.android.intent.action.MCS_HEARTBEAT"));
    

    不需要将心跳从 GCM 服务器发送到手机,您可以强制 android 自己更快地发送心跳。

    我查看了我测试并为我工作的 Push Notifications Fixer 应用程序,看来您需要做的就是广播以下意图:

    com.google.android.intent.action.MCS_HEARTBEAT
    com.google.android.intent.action.GTALK_HEARTBEAT
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-03-07
      • 1970-01-01
      • 2012-10-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多