Android AlarmManager RTC doesn't pause while device is sleeping

允我心安 提交于 2019-12-11 00:01:48

问题


I wrote a little widget for Android devices.

The widget uses AlarmManager to set recurring updates. I'm using the RTC clock for the AlarmManager.

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?

I'm using System.currentTimeMillis() for the starting time so it should be correct for RTC clock.


回答1:


You need to disconnect device from your desktop. When device is charging it doesn't go to sleep mode even when screen is black.



来源:https://stackoverflow.com/questions/3565622/android-alarmmanager-rtc-doesnt-pause-while-device-is-sleeping

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!