Android Viewer

v1.0.2
io.github.acertijosapps/android-viewer Checked 10 hours ago Published 29 days ago

Drive Android emulators: screenshots, taps, swipes, keys, text, rotation and foldable postures.

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

list_devices List devices

Lists the AVDs on this machine (with serial and booted when the emulator is running) and the adb devices that are not AVDs. An AVD with serial null is stopped: start it with launch_avd.

get_state Device state

Size and rotation of the active display, current posture and available postures (foldables). Includes the viewer URL to watch the device in a browser pane.

ParameterTypeDescription
serialstringadb serial (e.g. emulator-5556). Optional when only one device is connected.

screenshot Screenshot

Captures the active display (PNG). For tap/swipe use normalized coordinates: x = pixel_x / image width, y = pixel_y / image height.

ParameterTypeDescription
serialstringadb serial (e.g. emulator-5556). Optional when only one device is connected.

tap Tap

Taps a point on the screen (input tap).

ParameterTypeDescription
x *numberx coordinate, normalized 0–1 over the screenshot
y *numbery coordinate, normalized 0–1 over the screenshot
serialstringadb serial (e.g. emulator-5556). Optional when only one device is connected.

swipe Swipe

Swipes from one point to another (input swipe). With the same start and end point and a duration ≥ 500 ms it is a long press.

ParameterTypeDescription
x1 *numberStart x, normalized 0–1 over the screenshot
x2 *numberEnd x, normalized 0–1 over the screenshot
y1 *numberStart y, normalized 0–1 over the screenshot
y2 *numberEnd y, normalized 0–1 over the screenshot
duration_msintegerGesture duration in ms
serialstringadb serial (e.g. emulator-5556). Optional when only one device is connected.

press_key Press key

Presses a system key (input keyevent).

ParameterTypeDescription
key *stringKey
serialstringadb serial (e.g. emulator-5556). Optional when only one device is connected.

type_text Type text

Types ASCII text into the focused field (input text). For Enter use press_key.

ParameterTypeDescription
text *stringText to type
serialstringadb serial (e.g. emulator-5556). Optional when only one device is connected.

launch_avd Launch AVD

Starts an emulator by AVD name (see list_devices). Returns right away: wait until list_devices shows it with booted=true before using it.

ParameterTypeDescription
avd *stringAVD name, e.g. Pixel_10_Pro_Fold

rotate Rotate

Rotates the emulator 90° (like the emulator's rotate button). Emulators only.

ParameterTypeDescription
direction *stringDirection
serialstringadb serial (e.g. emulator-5556). Optional when only one device is connected.

set_posture Set posture

Changes the posture of a foldable. On emulators it moves the simulated hinge (`emu posture`); on physical devices or for REAR_DISPLAY it uses `cmd device_state state`. Accepts the name (closed, half_opened, opened, rear_display), the numeric id or "reset" to go back to the sensor posture. Returns the new state.

ParameterTypeDescription
posture *Name, id or "reset"
serialstringadb serial (e.g. emulator-5556). Optional when only one device is connected.