Is it possible to have an android application such that if the user starts it the phone will not switch off by pressing the side button? It means the only means to switch off it will be remove the battery, and taking all sort of permission from user is not an issue here.


No, it's not possible. The functionality to turn off the device if the power button is held down is at a very low level of the system, so that even if Android gets into some broken state, the user can still switch the device off to prevent it overheating. This is especially important on devices without a removable battery!

Only replacing the kernel with a custom-built one can disable the power button completely. This may or may not be possible depending on what device you're targeting and whether all the drivers and kernel source for that device are available.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.