简体   繁体   English

Google Cloud Messaging,如何控制邮件队列?

[英]Google Cloud Messaging , how to control the message queue?

I have implemented Google Cloud Messaging on Android. 我在Android上实施了Google Cloud Messaging。 When the device is no internet connection and receives messages accumulate in queue and when he returns to have internet connection receives all. 当设备没有互联网连接并且接收消息在队列中累积时,并且当他返回时,互联网连接全部接收。 This is a problem for me. 这对我来说是个问题。 I want that when the device has more than one message queue receives only one. 我希望当设备有多个消息队列只接收一个时。 This is possible? 这个有可能?

Is there any way to see the queue on the server? 有没有办法在服务器上查看队列?

Thank you 谢谢

Update... 更新中...

Work fine... 工作得很好......

$fields = array(
            'registration_ids' => $registrationIDs,
            'data' => array("message" => $message),
            'collapse_key' => $collapse_key,
        );

You do that with collapse_key . 你用collapse_key做到这一点。

It all the messages have the same collapge_key , only the last message will be stored in GCM server and delivered to the device when it's back online. 所有消息都具有相同的collapge_key ,只有最后一条消息将存储在GCM服务器中,并在重新联机时传送到设备。

collapse_key collapse_key的

An arbitrary string (such as "Updates Available") that is used to collapse a group of like messages when the device is offline, so that only the last message gets sent to the client. 一个任意字符串(例如“可用更新”),用于在设备脱机时折叠一组类似的消息,以便只将最后一条消息发送到客户端。 This is intended to avoid sending too many messages to the phone when it comes back online. 这是为了避免在重新联机时向手机发送过多消息。 Note that since there is no guarantee of the order in which messages get sent, the "last" message may not actually be the last message sent by the application server. 请注意,由于无法保证发送消息的顺序,“最后”消息实际上可能不是应用程序服务器发送的最后一条消息。 Collapse keys are also called send-to-sync messages. 折叠键也称为发送到同步消息。

( Source ) 来源

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM