0

how to detect power button at lock screen android 9.1 honor mobile device I want to control my power button at lock screen for performing a particular task when the long press of power button in android devices

Markus Kauppinen
  • 3,025
  • 4
  • 20
  • 30
  • Possible duplicate of [Android - Count Power button clicks and Start Activity](https://stackoverflow.com/questions/15609008/android-count-power-button-clicks-and-start-activity) – zappee Jul 31 '19 at 14:04

1 Answers1

0

You might be able to achieve this with a BroadcastReceiver listening for Intent.ACTION_SCREEN_OFF/Intent.ACTION_SCREEN_ON or overriding a dispatchKeyEvent for KeyEvent.KEYCODE_POWER.

a_local_nobody
  • 7,947
  • 5
  • 29
  • 51
devchimp
  • 754
  • 6
  • 18