确定 Android 中自上次用户活动以来的时间

发布于 2024-09-26 18:35:11 字数 55 浏览 0 评论 0原文

您如何发现设备将来何时会进入睡眠状态?

或者,至少,最后一次用户活动是什么时候?

How do you discover when, in the future, the device is expected to sleep?

Or, at least, when the last user activity was?

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

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

发布评论

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

评论(1

夜巴黎 2024-10-03 18:35:11

您如何发现设备将来何时会进入睡眠状态?

你不知道。没有用于此目的的 API。在用户指定的超时时间过后以及所有未完成的 WakeLocks 被释放后,设备将进入睡眠状态。无法预测设备何时进入睡眠状态,因为操作系统不知道这些 WakeLocks 何时会被释放。

How do you discover when, in the future, the device is expected to sleep?

You don't. There is no API for this. The device will go to sleep after the user-specified timeout has elapsed and after all outstanding WakeLocks are released. It is impossible to predict when the device will go to sleep, since the OS has no idea when those WakeLocks will be released.

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