Android Question power button keycode (samsung Android 9)

peacemaker

Expert
Licensed User
Longtime User
HI, All

Is it possible to just trap the power key click, or long tap ? Even if root access is avalable.
 

DonManfred

Expert
Licensed User
Longtime User
I don´t think this can be captured.
You need to check Google Documentation (or search google) on how about it works or not on rooted devices. But even here i expect NO.
 
Upvote 0

peacemaker

Expert
Licensed User
Longtime User
"android.intent.action.SCREEN_OFF" intent is got via BroadcastReceiver OK.
The puzzle is to get root ... to try to use "reboot" and "shutdown".

p.s. but the power bitton keycode is also existsing, and maybe can be cought with root ... :)
 
Upvote 0
Top