开发者

override power button callback

开发者 https://www.devze.com 2023-02-28 15:21 出处:网络
Is it possible in an acitvity override the 开发者_开发百科callback called when the power button is pressed? My target is to prevent the screen off.

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


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消