覆盖电源按钮回调
Is it possible in an acitvity override the callback called when the power button is pressed? My target is to prevent the screen off.
I found this - How to hook into the Power button in Android? -but it seems don't work.
THX
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用唤醒锁保持屏幕打开:
http://developer.android.com/reference/android/os/PowerManager.html
但你应该小心它,因为它确实会耗尽电池。
You can keep the screen on with a wake lock:
http://developer.android.com/reference/android/os/PowerManager.html
But you should be carefull with it because it really drains the battery.