而设备的Android睡觉RTC AlarmManager不停顿 [英] Android AlarmManager RTC doesn't pause while device is sleeping
问题描述
我写了一个小部件的Android设备。
I wrote a little widget for Android devices.
小部件使用 AlarmManager
来设置经常性的更新。
我使用了 RTC
时钟 AlarmManager
。
The widget uses AlarmManager
to set recurring updates.
I'm using the RTC
clock for the AlarmManager
.
根据该文件,如果该设备是睡觉时, RTC
时钟不会唤醒设备,并在下次更新将是当设备被唤醒。
According to the documentation, if the device is sleeping, the RTC
clock won't wake up the device and the next update will be when the device is woken.
我有这表明,当它被更新部件的日志文件。
I have a log file for the widget which shows when it was updated.
即使我不碰设备,我仍然看到在日志文件的更新。
Even when I don't touch the device , I still see updates in the log file.
这是为什么?不应设备中睡觉,所以我不小部件应该更新?
Why is that? shouldn't the device be sleeping and thus my widget shouldn't update?
我用 System.currentTimeMillis的()
的起始时间,所以它应该是 RTC正确
时钟
I'm using System.currentTimeMillis()
for the starting time so it should be correct for RTC
clock.
推荐答案
您需要从桌面断开连接的设备。当设备充电不会进入睡眠模式,即使屏幕是黑的。
You need to disconnect device from your desktop. When device is charging it doesn't go to sleep mode even when screen is black.
这篇关于而设备的Android睡觉RTC AlarmManager不停顿的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!