Learn how to control Android devices in DroidRun using the comprehensive tools API. Tools provide the bridge between your AI agents and Android devices, enabling UI interaction, app management, and state analysis. Use tools directly or through DroidAgent for automated Android testing and control.
tap_by_index(index: int) -> str
get_state()
first.
swipe(start_x: int, start_y: int, end_x: int, end_y: int, duration_ms: int = 300) -> bool
input_text(text: str) -> str
press_key(keycode: int) -> str
back() -> str
start_app(package: str, activity: str = "") -> str
list_packages(include_system_apps: bool = False) -> List[str]
install_app(apk_path: str, reinstall: bool = False, grant_permissions: bool = True) -> str
get_state(serial: Optional[str] = None) -> Dict[str, Any]
take_screenshot() -> Tuple[str, bytes]
Function | Purpose | Returns |
---|---|---|
tap_by_index(index) | Tap UI element by index | Status message |
swipe(x1, y1, x2, y2, duration) | Swipe gesture | Success boolean |
input_text(text) | Type text | Status message |
press_key(keycode) | Press Android key | Status message |
back() | Press back button | Status message |
start_app(package, activity) | Launch application | Status message |
list_packages(include_system) | List installed apps | Package list |
install_app(path, reinstall, permissions) | Install APK | Status message |
get_state(serial) | Get device state | State dictionary |
take_screenshot() | Capture screen | Format and image data |
remember(info) | Store information | Confirmation message |
get_memory() | Retrieve stored info | Memory list |
complete(success, reason) | Finish task | None |