Adb Utils
Device - High-level representation of an Android device.
Device
High-level representation of an Android device.
Device.__init__
Initialize device.
Arguments:
serial
- Device serial numberadb
- ADB wrapper instance
Device.serial
Get device serial number.
Device.get_properties
Get all device properties.
Device.get_property
Get a specific device property.
Device.model
Get device model.
Device.brand
Get device brand.
Device.android_version
Get Android version.
Device.sdk_level
Get SDK level.
Device.shell
Execute a shell command on the device.
Device.tap
Tap at coordinates.
Arguments:
x
- X coordinatey
- Y coordinate
Device.swipe
Perform swipe gesture.
Arguments:
start_x
- Starting X coordinatestart_y
- Starting Y coordinateend_x
- Ending X coordinateend_y
- Ending Y coordinateduration_ms
- Swipe duration in milliseconds
Device.input_text
Input text.
Arguments:
text
- Text to input
Device.press_key
Press a key.
Arguments:
keycode
- Android keycode to press
Device.start_activity
Start an app activity.
Arguments:
package
- Package nameactivity
- Activity nameextras
- Intent extras
Device.start_app
Start an app on the device.
Arguments:
package
- Package nameactivity
- Optional activity name (if empty, launches default activity)
Returns:
Result message
Device.install_app
Install an APK on the device.
Arguments:
apk_path
- Path to the APK filereinstall
- Whether to reinstall if app existsgrant_permissions
- Whether to grant all requested permissions
Returns:
Installation result
Device.uninstall_app
Uninstall an app from the device.
Arguments:
package
- Package name to uninstallkeep_data
- Whether to keep app data and cache directories
Returns:
Uninstallation result
Device.take_screenshot
Take a screenshot of the device and compress it.
Arguments:
quality
- JPEG quality (1-100, lower means smaller file size)
Returns:
Tuple of (local file path, screenshot data as bytes)
Device.list_packages
List installed packages on the device.
Arguments:
include_system_apps
- Whether to include system apps (default: False)
Returns:
List of package names
Device Manager - Manages Android device connections.
DeviceManager
Manages Android device connections.
DeviceManager.__init__
Initialize device manager.
Arguments:
adb_path
- Path to ADB binary
DeviceManager.list_devices
List connected devices.
Returns:
List of connected devices
DeviceManager.get_device
Get a specific device.
Arguments:
serial
- Device serial number
Returns:
Device instance if found, None otherwise
DeviceManager.connect
Connect to a device over TCP/IP.
Arguments:
host
- Device IP addressport
- Device port
Returns:
Connected device instance
DeviceManager.disconnect
Disconnect from a device.
Arguments:
serial
- Device serial number
Returns:
True if disconnected successfully