Rotate the screen
android_set_rotationSet the Android display to a specific orientation for layout testing, or switch back to auto-rotate. Useful for checking UI in portrait and landscape modes.
Instructions
Force the display into a specific orientation, or hand control back to the accelerometer.
Setting a fixed rotation turns auto-rotate off first; otherwise the sensor immediately overrides it. Use 'auto' to restore normal behaviour.
Rotating is the fastest way to check a layout in both orientations. Note that an app locking its own orientation in the manifest wins over this — the display will not turn.
Args:
orientation ('portrait' | 'landscape' | 'portrait_reverse' | 'landscape_reverse' | 'auto')
serial (string, optional): target device
Returns: { "requested": string, "rotationDegrees": number, "serial": string }
Examples:
Use when: checking a tablet layout in landscape -> orientation="landscape"
Use when: restoring the device after testing -> orientation="auto"
Don't use when: the app declares a fixed screenOrientation; change the manifest instead
Error Handling:
If the reported rotation does not change, the foreground app is locking its orientation
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| serial | No | Device serial from android_list_devices. Optional when exactly one device is connected; required when several are. | |
| orientation | Yes | Target orientation, or 'auto' to re-enable the accelerometer. |