| name | foxctl Mobile Android |
| description | Android Emulator automation via ADB - device management, app lifecycle, UI interaction, accessibility inspection, debugging, and system analysis. |
Android Emulator Automation
Full Android Emulator control via ADB (Android Debug Bridge).
Prerequisites
Install ADB:
brew install android-platform-tools
Device Management
List Emulators
foxctl run mobile/android --input '{"operation": "list_devices"}'
Get Device Info
foxctl run mobile/android --input '{"operation": "device_info"}'
foxctl run mobile/android --input '{"operation": "device_info", "serial": "emulator-5554"}'
Returns device properties including model, Android version, SDK level, screen size, and CPU architecture.
App Lifecycle
Install APK
foxctl run mobile/android --input '{"operation": "install", "app": "/path/to/app.apk"}'
Launch App
foxctl run mobile/android --input '{"operation": "launch", "app": "com.example.myapp"}'
foxctl run mobile/android --input '{
"operation": "launch",
"app": "com.example.myapp",
"activity": ".MainActivity"
}'
Terminate App
foxctl run mobile/android --input '{"operation": "terminate", "app": "com.example.myapp"}'
Screenshots & Recording
Take Screenshot
foxctl run mobile/android --input '{"operation": "screenshot"}'
foxctl run mobile/android --input '{"operation": "screenshot", "output": "/tmp/screen.png"}'
Video Recording
foxctl run mobile/android --input '{"operation": "record_screen", "output": "/tmp/recording.mp4"}'
foxctl run mobile/android --input '{"operation": "record_stop"}'
UI Interaction
Tap
foxctl run mobile/android --input '{"operation": "tap", "x": 540, "y": 960}'
Swipe
foxctl run mobile/android --input '{
"operation": "swipe",
"x": 540, "y": 1500,
"x2": 540, "y2": 500,
"duration": 300
}'
Type Text
foxctl run mobile/android --input '{"operation": "type_text", "text": "Hello World"}'
Press Key
foxctl run mobile/android --input '{"operation": "press_key", "keycode": "HOME"}'
foxctl run mobile/android --input '{"operation": "press_key", "keycode": "BACK"}'
foxctl run mobile/android --input '{"operation": "press_key", "keycode": "MENU"}'
foxctl run mobile/android --input '{"operation": "press_key", "keycode": "ENTER"}'
foxctl run mobile/android --input '{"operation": "press_key", "keycode": "VOLUME_UP"}'
foxctl run mobile/android --input '{"operation": "press_key", "keycode": "VOLUME_DOWN"}'
UI Inspection
Get UI Hierarchy
foxctl run mobile/android --input '{"operation": "ui_tree"}'
Returns parsed UI elements with:
class: View class (e.g., android.widget.Button)
text: Displayed text
resource_id: Resource identifier
content_desc: Accessibility description
bounds: Position [x1,y1][x2,y2]
clickable, enabled, focused: States
Debugging
Get Logcat
foxctl run mobile/android --input '{"operation": "logs"}'
Filter Logcat
foxctl run mobile/android --input '{"operation": "logcat_filter", "tag": "MyApp"}'
foxctl run mobile/android --input '{"operation": "logcat_filter", "tag": "MyApp", "level": "E"}'
Levels: V (Verbose), D (Debug), I (Info), W (Warn), E (Error), F (Fatal)
Dumpsys
Get system service information:
foxctl run mobile/android --input '{"operation": "dumpsys", "service": "activity"}'
foxctl run mobile/android --input '{"operation": "dumpsys", "service": "window"}'
foxctl run mobile/android --input '{"operation": "dumpsys", "service": "battery"}'
foxctl run mobile/android --input '{"operation": "dumpsys", "service": "meminfo"}'
foxctl run mobile/android --input '{"operation": "dumpsys", "service": "package"}'
foxctl run mobile/android --input '{"operation": "dumpsys", "service": "cpuinfo"}'
Permissions
Grant Runtime Permission
foxctl run mobile/android --input '{
"operation": "grant_permission",
"app": "com.example.myapp",
"permission": "android.permission.CAMERA"
}'
foxctl run mobile/android --input '{
"operation": "grant_permission",
"app": "com.example.myapp",
"permission": "READ_EXTERNAL_STORAGE"
}'
File Transfer
Pull File from Device
foxctl run mobile/android --input '{
"operation": "pull_file",
"remote_path": "/sdcard/Download/file.txt",
"local_path": "/tmp/file.txt"
}'
Push File to Device
foxctl run mobile/android --input '{
"operation": "push_file",
"local_path": "/tmp/test.json",
"remote_path": "/sdcard/Download/test.json"
}'
Open URL
foxctl run mobile/android --input '{"operation": "open_url", "url": "https://example.com"}'
foxctl run mobile/android --input '{"operation": "open_url", "url": "myapp://deeplink/path"}'
All Operations
| Operation | Description |
|---|
list_devices | List Android emulators |
device_info | Get device properties |
install | Install APK |
launch | Launch app by package |
terminate | Stop app by package |
screenshot | Capture screen |
tap | Tap at coordinates |
swipe | Swipe gesture |
type_text | Input text |
press_key | Press Android keycode |
ui_tree | Get UI hierarchy |
logs | Get logcat output |
logcat_filter | Filtered logcat |
open_url | Open URL/deep link |
grant_permission | Grant runtime permission |
record_screen | Start video recording |
record_stop | Stop video recording |
dumpsys | Get system service info |
pull_file | Download file from device |
push_file | Upload file to device |
Common Keycodes
| Keycode | Description |
|---|
HOME | Home button |
BACK | Back button |
MENU | Menu button |
ENTER | Enter key |
DEL | Delete/backspace |
TAB | Tab key |
ESCAPE | Escape key |
VOLUME_UP | Volume up |
VOLUME_DOWN | Volume down |
POWER | Power button |
CAMERA | Camera button |
Common Workflows
Testing an App
- List devices:
list_devices
- Install APK:
install
- Grant permissions:
grant_permission
- Launch app:
launch
- Take screenshots:
screenshot
- Inspect UI:
ui_tree
- Check logs:
logs or logcat_filter
Debugging a Crash
- Filter error logs:
logcat_filter with level: "E"
- Get activity state:
dumpsys with service: "activity"
- Inspect UI:
ui_tree
- Pull crash files:
pull_file from /sdcard/