ADBDebuggingSafe
adb shell input keyevent <keycode>
Simulate physical hardware key press
What It Does
Sends a simulated hardware key code event to the device window manager (e.g. Home, Back, Power, Volume).
Command Syntax
Terminal
$
adb shell input keyevent <keycode_number_or_name>Parameters & Placeholders Breakdown
This command syntax includes specific placeholder tokens. Below is an explanation of what each word represents and concrete real-world values to replace it with:
<keycode_number_or_name>Android Hardware Keycode NumberThe numeric keycode constant representing a physical or navigation button event.
Real-world value:26 (Power) or 3 (Home) or 4 (Back) or 224 (Wakeup)
Command syntax:
adb shell input keyevent 26Keycode 26 toggles the power screen on/off; Keycode 3 returns to Home.
<keycode>Android Hardware Keycode NumberThe numeric keycode constant representing a physical or navigation button event.
Real-world value:26 (Power) or 3 (Home) or 4 (Back) or 224 (Wakeup)
Command syntax:
adb shell input keyevent 26Keycode 26 toggles the power screen on/off; Keycode 3 returns to Home.
Usage Examples
$
adb shell input keyevent 3$
adb shell input keyevent 4$
adb shell input keyevent 26$
adb shell input keyevent 82Options & Flags
| Flag / Parameter | Description |
|---|---|
| 3 | KEYCODE_HOME |
| 4 | KEYCODE_BACK |
| 26 | KEYCODE_POWER |
| 66 | KEYCODE_ENTER |
| 82 | KEYCODE_MENU |
Prerequisites & Requirements
- Device connected
Related Commands
Found an error or missing flag for
adb shell input keyevent <keycode>?Submit a correction or request additional examples on GitHub.
Having issue? Contact @mkr_infinity
Direct technical assistance & ROM flashing troubleshooting by Mohammad Kaif Raja.