在android中重置屏幕超时
我使用以下代码来唤醒手机的屏幕:
PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
wl = pm.newWakeLock(PowerManager.FULL_WAKE_LOCK | PowerManager.ACQUIRE_CAUSES_WAKEUP, "XPAND-IT");
wl.acquire();
运行此代码后,我想重置屏幕超时以释放唤醒锁。我该怎么做呢?
I'm using the following code to wake the phone's screen:
PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
wl = pm.newWakeLock(PowerManager.FULL_WAKE_LOCK | PowerManager.ACQUIRE_CAUSES_WAKEUP, "XPAND-IT");
wl.acquire();
After this code runs, I want to reset the screen timeout to release the wake lock. How can I do it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我假设您遇到以下问题:
一个简单的解决方案:添加标志
PowerManager.ON_AFTER_RELEASE
,并且在释放唤醒锁时重置超时。I assume you have the following problem:
There's a simple solution for this: Add the flag
PowerManager.ON_AFTER_RELEASE
and the timeout is reset when releasing the wake lock.