安卓能否在BroadcastRceiver中处理广播时进入深度睡眠状态?是否需要在BroadcastReceiver onReceive方法中尽早创建部分唤醒,还是可以在onReceive方法中的任何地方创建(并传递给服务)?
AlarmManager文档声明The Alarm Manager holds a CPU wake lock as long as the alarm receiver's onReceive() method is executing. This guarantees that the phone will not sleep until you have finished handling the broadcast.,但是其他广播呢?或者这仅仅取决于广播的发送方?
发布于 2013-05-04 21:49:15
安卓能否在BroadcastRceiver中处理广播时进入深度睡眠状态?
一般来说,是的。一个值得注意的例外是,如果BroadcastReceiver是由AlarmManager和getBroadcast() PendingIntent触发的。
是否需要在BroadcastReceiver onReceive方法中尽早创建部分唤醒,还是可以在onReceive方法中的任何地方创建(并传递给服务)?
嗯,您不能很容易地将一个WakeLock传递给一个服务,这就是我编写WakefulIntentService的原因。
但是其他广播呢?或者这仅仅取决于广播的发送方?
除了前面提到的Intent场景之外,我不知道任何其他自动保存WakeLock的广播AlarmManager。其中一个可能是SMS_RECEIVED,因为收到的短信也可以唤醒设备。
https://stackoverflow.com/questions/16379128
复制相似问题