Android AlarmManager RTC 在设备睡眠时不会暂停

发布于 2024-09-15 18:37:53 字数 399 浏览 4 评论 0原文

我为 Android 设备编写了一个小部件。

该小部件使用 AlarmManager 来设置定期更新。 我将 RTC 时钟用于 AlarmManager

根据文档,如果设备正在睡眠,RTC时钟将不会唤醒设备,下一次更新将在设备被唤醒时进行。

我有一个小部件的日志文件,其中显示了它的更新时间。

即使我不触摸设备,我仍然可以在日志文件中看到更新。

这是为什么?设备不应该处于睡眠状态,因此我的小部件不应该更新吗?

我使用 System.currentTimeMillis() 作为开始时间,因此它对于 RTC 时钟来说应该是正确的。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

花海 2024-09-22 18:37:55

您需要断开设备与桌面的连接。设备充电时,即使屏幕黑屏也不会进入睡眠模式。

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文