在广播接收器中播放铃声
我使用挂起的意图和广播接收器来处理挂起的事件。当broadcast_receiver接收到一个intent时,它会创建一个带有STREAM_NOTIFICATION和“play()”的铃声实例。但声音却晚了几十分钟!
我已检查挂起的信号是否在适当的时间到达,并且广播接收器是否正确处理它们。
当手机处于睡眠模式(屏幕关闭)时播放通知似乎存在问题。
有人知道如何绕过这个问题吗?
I use pending_intents and a broadcast_receiver for pending events processing. When the broadcast_receiver receives an intent it creates an instance of a ringtone with STREAM_NOTIFICATION and `play()' it. But sounds is late for a few dozen minutes!
I have checked that the pending_intens are come in proper time and the broadcast_receiver processes them properly.
It seems there is a problem with playing notifications while a phone stay in sleep mode (screen is off).
Somebody know how to bypass the problem?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看来应该使用 PowerManager 和 WakeLock 类来启用处理器单元。
It seems that the PowerManager and WakeLock classes should be used to enable processor unit.