Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
您如何发现设备在未来何时会进入睡眠状态?
或者,至少,最后一次用户活动是什么时候?
你没有。没有用于此的 API。在用户指定的超时时间过后并且所有未完成WakeLocks的都被释放后,设备将进入睡眠状态。无法预测设备何时会进入睡眠状态,因为操作系统不知道它们何时WakeLocks会被释放。
WakeLocks