Press a hardware or system key
android_key_eventSend Android key events like Back, Home, Enter, and arrow keys to navigate screens, dismiss dialogs, or trigger system actions without needing to tap the screen.
Instructions
Send a key event — Back, Home, Enter, arrows, volume and so on.
Args:
key (string): key name without the KEYCODE_ prefix. One of: BACK, HOME, MENU, APP_SWITCH, ENTER, TAB, DEL, FORWARD_DEL, ESCAPE, DPAD_UP, DPAD_DOWN, DPAD_LEFT, DPAD_RIGHT, DPAD_CENTER, VOLUME_UP, VOLUME_DOWN, WAKEUP, SLEEP, POWER, CAMERA, SEARCH, MEDIA_PLAY_PAUSE, MEDIA_NEXT, MEDIA_PREVIOUS, PAGE_UP, PAGE_DOWN, MOVE_HOME, MOVE_END
serial (string, optional): target device
repeat (number): how many times to send it, 1-20 (default: 1)
Returns: { "key": string, "repeat": number, "serial": string }
Examples:
Use when: navigating back out of a screen -> key="BACK"
Use when: dismissing to the launcher before a cold start -> key="HOME"
Use when: submitting a form without tapping -> key="ENTER"
Use when: the screen is off and you need to see it -> key="WAKEUP" (POWER toggles, so it can turn the screen back off)
Don't use when: typing characters (use android_input_text)
Error Handling:
An unrecognised key name is rejected with the list of supported keys
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| key | Yes | Key name without the KEYCODE_ prefix. | |
| repeat | No | How many times to send it. | |
| serial | No | Device serial from android_list_devices. Optional when exactly one device is connected; required when several are. |