android 推送通知 c2dm
我已经使用 google c2dm 成功实现了 android 推送通知。 问题是,当我从服务器推送消息时,我获得了成功的完整设备 ID。但设备有时会收到推送消息,有时则没有收到。(wifi 完全处于活动状态)
我希望应用程序能够接收所有推送消息,而不会丢失任何推送消息,因为每个通知都很重要。
是否需要设置任何特殊参数或我会确认设备已成功接收消息。
I have successfully implemented the android push notification using google c2dm.
the problem is,when i push the message from the server i am getting success full deveice id. but the device some time receive push message,some time did not receive.(wifi is fully active)
i want the app to receive all the push message with out any push message lose,becoz each notification is important.
Is there any special parameter need to set or hw i would i confirm that device successfully received the message.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
“C2DM 不保证消息的传递或顺序。因此,例如,虽然您可能使用此功能告诉即时消息应用程序用户有新消息,但您可能不会使用它来传递实际消息。”
但你可以尝试使用 2 个参数:
collapse_key
任意字符串,用于在设备离线时折叠一组类似消息,以便仅将最后一条消息发送到客户端。这是为了避免在手机恢复在线状态时向其发送过多消息。请注意,由于无法保证消息发送的顺序,因此“最后”消息实际上可能不是应用程序服务器发送的最后一条消息。必需的。
空闲时延迟
如果包含,则表示如果设备空闲,则不应立即发送消息。服务器将等待设备变为活动状态,然后仅发送每个collapse_key值的最后一条消息。选修的。
"C2DM makes no guarantees about delivery or the order of messages. So, for example, while you might use this feature to tell an instant messaging application that the user has new messages, you probably would not use it to pass the actual messages."
But you can try to play with 2 parameters:
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.
delay_while_idle
If included, indicates that the message should not be sent immediately if the device is idle. The server will wait for the device to become active, and then only the last message for each collapse_key value will be sent. Optional.