Reputation: 338
I have a custom ROM of Android and want to launch my app if power button is press specific number of times. I will make my app a System app so that it will have system privilege. I know power button press broadcast is not possible for user apps but for system apps it should be possible, if anyone knows please help me. For example: Three times press the power button call the SOS number.
Upvotes: 0
Views: 190
Reputation: 10610
Simplest way would probably be to put your code in frameworks/base/services/core/java/com/android/server/GestureLauncherService.java
.
Take a look at the patch implementing double-tap to launch camera for reference. https://android.googlesource.com/platform/frameworks/base/+/5941c98%5E%21/
Upvotes: 2