android – WhatsApp如何克服GCM推送通知延迟?

前端之家收集整理的这篇文章主要介绍了android – WhatsApp如何克服GCM推送通知延迟?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我正在尝试使用GCM服务,除了GCM推送通知或提供有效载荷的长时间延迟之外,每件事情都是正常的,有些时候我的App 5分钟会收到通知或有效载荷.
我需要立即交付…
我知道GCM的角色,等到其他设备上线,但在我的情况下,我持有两个设备,他们在线,但我收到延迟通知

WhatsApp(作为使用GCM的应用程序的示例)如何克服这个问题..并立即发送?

[即(消息类型:打字,在线 – 最后看到)不能延迟…]

GCM延迟推送是已知的问题:this issue
我的问题是:使用GCM的其他应用程序如何克服这个问题

解决方法@H_403_13@
发送通知时,您可以将 priority-parameter设置为“高”.

从文档:

By default,messages are sent with normal priority. Normal priority optimizes the client app’s battery consumption,and should be used unless immediate delivery is required. For messages with normal priority,the app may receive the message with unspecified delay.

When a message is sent with high priority,it is sent immediately,and the app can wake a sleeping device and open a network connection to your server.

我知道这个答案迟到了,但是如果你还在面对这个问题(或任何其他人),请告诉我是否有帮助.

原文链接:https://www.f2er.com/android/313117.html

猜你在找的Android相关文章