C2DM crash_key 字段中应包含哪些内容
我正在我的android推送应用程序上实现C2DM,这就是谷歌关于collapse_key的说法:
“一个任意字符串,用于在设备离线时折叠一组类似的消息,以便仅发送最后一条消息这是为了避免在手机重新上线时向客户端发送太多消息。请注意,由于无法保证消息发送的顺序,因此“最后一条”消息实际上可能不是最后一条消息。由应用程序服务器发送。”
我想知道如果我想获取设备离线期间发送的所有推送,我应该在崩溃密钥中包含什么以及如何做到这一点?
I'm implementing C2DM on my android push application, this is what google said about collapse_key:
"An arbitrary string 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. Required."
I was wondering what if i want to get all the push sent during the device offline, what should i have in the collapse_key and how can i do that?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我认为你应该为每条消息创建一个新的/不同的折叠键。你可以有一个随着时间的推移而不断变大的整数,或者你可以只使用系统时间......
I think you should then make a new/different collaps-key for every message. You could just have an integer that keeps getting bigger over time or you could just use the system time...
虽然 CD2M 已被弃用,取而代之的是 GCM,但考虑至少 GCM 只允许有 4 个折叠键
While CD2M was deprecreated in favor for GCM, take into account that at least GCM allows to have only 4 collapse keys