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.
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/
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.