Android C2DM 休眠手机
根据 Android C2DM 通过心跳机制,使其能够接收推送消息。这让我希望能够通过有效的 WiFi 连接向休眠手机发送消息。
我已经实现了将“delay_while_idle”设置为“0”。如果我的手机屏幕关闭,则会发送该消息,但如果手机进入睡眠状态,则不会发送该消息(测试间隔为 20 分钟,1-6 小时)。
我已经获得了部分 cpu 锁定 + 完整 wifi 锁定以防万一。
我是否犯了一些根本性错误,或者我是否误解了 C2DM 推送功能?
我可以向休眠手机发送消息吗?
According to this Android C2DM keeps a socket alive with a heartbeat mechanism, making it able to receive push messages. This made me hope I could deliver messages to sleeping phones with an active wifi connection.
I've made an implementation setting the "delay_while_idle" to '0'. The message is delivered if my phones' screen is powered off, but not if the phone goes to sleep (tested with intervals 20mins, 1-6 hours).
I have acquired a partial cpu lock + a full wifi lock just in case.
Have I simply made something fundamentally wrong or did I misunderstand the C2DM push functionality?
Can I send messages to sleeping phones or not?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用闹钟管理器而不是唤醒锁可以让您的手机保持足够的活力。请参阅此实现。将测试它的一个变体。
Using alarmmanager instead of wakelocks could keep your phone alive just enough. See this implementation. Will test a variant of this.