当 cpu 关闭时,广播接收器是否接收到意图?
Do broadcast receivers receive intents when the cpu is off?
我正在尝试接收日期更改事件,但假设 cpu 已关闭,系统会发送广播吗?我能否在 WakefulBroadcastReceiver
中接收广播并完成工作?
CPU 永远不会完全关闭。而 WakefulBroadcastReciever
将确保当接收到意图时,设备保持唤醒状态,直到接收器中执行的操作完成。
来自 WakefulBroadcastReceiver 的文档:
Helper for the common pattern of implementing a BroadcastReceiver that
receives a device wakeup event and then passes the work off to a
Service, while ensuring that the device does not go back to sleep
during the transition.
所以它接收到一个设备唤醒事件,但没有触发它。
发送方有责任确保正确接收广播。为此,您可以使用 AlarmManager
。这是一个tutorial.
我正在尝试接收日期更改事件,但假设 cpu 已关闭,系统会发送广播吗?我能否在 WakefulBroadcastReceiver
中接收广播并完成工作?
CPU 永远不会完全关闭。而 WakefulBroadcastReciever
将确保当接收到意图时,设备保持唤醒状态,直到接收器中执行的操作完成。
来自 WakefulBroadcastReceiver 的文档:
Helper for the common pattern of implementing a BroadcastReceiver that receives a device wakeup event and then passes the work off to a Service, while ensuring that the device does not go back to sleep during the transition.
所以它接收到一个设备唤醒事件,但没有触发它。
发送方有责任确保正确接收广播。为此,您可以使用 AlarmManager
。这是一个tutorial.