Skip to content

Input Control

Prerequisites

Input control commands require an active device connection. Run pb connect <device_code> first.

Tap

pb tap <x> <y>

Tap a point on the screen at the given coordinates.

ParameterTypeRequiredDescription
xintegerYesX coordinate
yintegerYesY coordinate

Examples:

bash
pb tap 540 960

# Also supports adb-style syntax
pb input tap 540 960
text
✓ OK
json
{
  "code": 200,
  "data": true,
  "msg": "OK"
}

Swipe

pb swipe <x1> <y1> <x2> <y2>

Perform a swipe gesture using a Bezier curve from one point to another.

ParameterTypeRequiredDescription
start_xintegerYesStarting X coordinate
start_yintegerYesStarting Y coordinate
end_xintegerYesEnding X coordinate
end_yintegerYesEnding Y coordinate

Examples:

bash
# Swipe up (scroll down)
pb swipe 540 1500 540 500

# Also supports adb-style syntax
pb input swipe 540 1500 540 500

Text Input

pb text <text>

Input text on the device. Works with the currently focused text field.

ParameterTypeRequiredDescription
textstringYesText to input

Examples:

bash
pb text "Hello World"

# Also supports adb-style syntax
pb input text "Hello World"

Key Event

pb keyevent <key>

Send a key event to the device. Supports both key names and numeric key codes.

ParameterTypeRequiredDescription
keystring/integerYesKey name (e.g., HOME) or numeric code (e.g., 3)

Examples:

bash
# By name
pb keyevent HOME
pb keyevent BACK
pb keyevent ENTER

# By numeric code
pb keyevent 3

# adb-style syntax
pb input keyevent BACK

Key Name Reference

Key NameAliasesCodeDescription
HOME3Home button
BACK4Back button
CALL5Answer call
ENDCALL6End call
DPAD_UPUP19D-pad up
DPAD_DOWNDOWN20D-pad down
DPAD_LEFTLEFT21D-pad left
DPAD_RIGHTRIGHT22D-pad right
DPAD_CENTERCENTER23D-pad center/OK
VOLUME_UP24Volume up
VOLUME_DOWN25Volume down
POWER26Power button
CAMERA27Camera button
CLEAR28Clear
TAB61Tab
SPACE62Space
ENTER66Enter/confirm
DELDELETE, BACKSPACE67Delete (backspace)
MENU82Menu
NOTIFICATION83Notification panel
SEARCH84Search
MEDIA_PLAY_PAUSE85Play/pause media
MEDIA_STOP86Stop media
MEDIA_NEXT87Next track
MEDIA_PREVIOUS88Previous track
MUTE91Mute
PAGE_UP92Page up
PAGE_DOWN93Page down
ESCAPEESC111Escape
FORWARD_DEL112Forward delete
CAPS_LOCK115Caps lock
MOVE_HOME122Move to beginning
MOVE_END123Move to end
INSERT124Insert
MEDIA_PLAY126Play media
MEDIA_PAUSE127Pause media

TIP

Key names are case-insensitive. You can also use the KEYCODE_ prefix (e.g., KEYCODE_HOME).