Skip to content

droidrun/mobilerun-portal

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

316 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation







GitHub stars Discord Documentation Twitter Follow



Get it on GitHub

πŸ‘οΈ Overview

Mobilerun Portal is an Android accessibility service that provides real-time visual feedback and data collection for UI elements on the screen. It creates an interactive overlay that highlights clickable, checkable, editable, scrollable, and focusable elements, making it an invaluable tool for UI testing, automation development, and accessibility assessment.

✨ Features

  • Interactive overlay that highlights clickable, checkable, editable, scrollable, and focusable elements
  • Local control APIs (HTTP socket server, WebSocket JSON-RPC, and ContentProvider)
  • Reverse WebSocket connection for cloud control
  • WebRTC screen streaming with auto-accept support
  • APK install from URLs (including split APKs) with optional auto-accept
  • Notification event streaming with per-event toggles

πŸš€ Usage

βš™οΈ Setup

  1. Install the app on your Android device
  2. Enable the accessibility service in Android Settings β†’ Accessibility β†’ Mobilerun Portal
  3. Grant overlay permission when prompted
  4. (Optional) Open Settings in the app to enable local servers or reverse connection

πŸ” Auth Token (Local APIs)

Mobilerun Portal generates a local auth token for HTTP and WebSocket access.

  • In the app: copy the token from the main screen
  • Via ADB:
    adb shell content query --uri content://com.mobilerun.portal/auth_token

🧩 Local APIs

Mobilerun Portal exposes three local interfaces:

  • HTTP socket server (default port 8080)
  • WebSocket server (default port 8081)
  • ContentProvider (ADB commands)

See Local API for full details and examples. See Triggers and Events for trigger management methods, event taxonomy, and payload contracts.

πŸ“‘ WebSocket Events

Mobilerun Portal streams notification events over WebSocket when enabled in Settings.

See the WebSocket Events documentation for setup, permissions, and event formats. See Triggers and Events for the complete EventType and TriggerSource contract.

🌐 Reverse Connection (Cloud)

Enable reverse connection to let the device initiate an outbound WebSocket connection to a host (used by Mobilerun Cloud).

See Reverse Connection for configuration details and the streaming protocol. Trigger JSON-RPC methods are documented in Triggers and Events. The operator-facing screen-awake watchdog can also be enabled from Settings with Keep Screen Awake, or over WebSocket with screen/keepAwake/set and screen/keepAwake/status.

πŸ’» ADB Commands (ContentProvider)

All commands use the ContentProvider authority content://com.mobilerun.portal/.

Query Commands (Reading Data)

# Test connection (ping)
adb shell content query --uri content://com.mobilerun.portal/ping

# Get app version
adb shell content query --uri content://com.mobilerun.portal/version

# Get accessibility tree as JSON (visible elements with overlay indices)
adb shell content query --uri content://com.mobilerun.portal/a11y_tree

# Get full accessibility tree with ALL properties (complete node info)
adb shell content query --uri content://com.mobilerun.portal/a11y_tree_full

# Get full tree without filtering small elements (< 1% visibility)
adb shell content query --uri 'content://com.mobilerun.portal/a11y_tree_full?filter=false'

# Get phone state as JSON (current app, focused element, keyboard visibility)
adb shell content query --uri content://com.mobilerun.portal/phone_state

# Get combined state (accessibility tree + phone state)
adb shell content query --uri content://com.mobilerun.portal/state

# Get full combined state (full tree + phone state + device context)
adb shell content query --uri content://com.mobilerun.portal/state_full

# Get full state without filtering
adb shell content query --uri 'content://com.mobilerun.portal/state_full?filter=false'

# Get list of installed launchable apps
adb shell content query --uri content://com.mobilerun.portal/packages

# Get local auth token for HTTP/WS access
adb shell content query --uri content://com.mobilerun.portal/auth_token

# Get keep-screen-awake watchdog status
adb shell content query --uri content://com.mobilerun.portal/screen_keep_awake_status

Insert Commands (Actions & Configuration)

# Keyboard text input (base64 encoded, clears field first by default)
adb shell content insert --uri content://com.mobilerun.portal/keyboard/input --bind base64_text:s:"SGVsbG8gV29ybGQ="

# Keyboard text input without clearing the field first
adb shell content insert --uri content://com.mobilerun.portal/keyboard/input --bind base64_text:s:"SGVsbG8=" --bind clear:b:false

# Clear text in focused input field
adb shell content insert --uri content://com.mobilerun.portal/keyboard/clear

# Send key event via keyboard (e.g., Enter key = 66, Backspace = 67)
adb shell content insert --uri content://com.mobilerun.portal/keyboard/key --bind key_code:i:66

# Set overlay vertical offset (in pixels)
adb shell content insert --uri content://com.mobilerun.portal/overlay_offset --bind offset:i:100

# Toggle overlay visibility (show/hide)
adb shell content insert --uri content://com.mobilerun.portal/overlay_visible --bind visible:b:true
adb shell content insert --uri content://com.mobilerun.portal/overlay_visible --bind visible:b:false

# Configure REST API socket server port (default: 8080)
adb shell content insert --uri content://com.mobilerun.portal/socket_port --bind port:i:8090

# Enable/disable local WebSocket server (default port: 8081)
adb shell content insert --uri content://com.mobilerun.portal/toggle_websocket_server --bind enabled:b:true --bind port:i:8081

# Enable or disable the keep-screen-awake watchdog
adb shell content insert --uri content://com.mobilerun.portal/toggle_screen_keep_awake --bind enabled:b:true
adb shell content insert --uri content://com.mobilerun.portal/toggle_screen_keep_awake --bind enabled:b:false

# Configure reverse connection (host URL + optional token/service key)
adb shell content insert --uri content://com.mobilerun.portal/configure_reverse_connection --bind url_base64:s:"d3NzOi8vYXBpLm1vYmlsZXJ1bi5haS92MS9wcm92aWRlcnMvcGVyc29uYWwvam9pbg==" --bind token_base64:s:"WU9VUl9UT0tFTg==" --bind enabled:b:true
adb shell content insert --uri content://com.mobilerun.portal/configure_reverse_connection --bind service_key_base64:s:"WU9VUl9LRVk="

# Toggle production mode UI
adb shell content insert --uri content://com.mobilerun.portal/toggle_production_mode --bind enabled:b:true

Common Key Codes

Key Code Key Code
Enter 66 Backspace 67
Tab 61 Escape 111
Home 3 Back 4
Up 19 Down 20
Left 21 Right 22

πŸ“€ Data Output

Element data is returned in JSON format through the ContentProvider queries. The response includes a status field and the requested data. All responses follow this structure:

{
  "status": "success",
  "result": "..."
}

For error responses:

{
  "status": "error", 
  "error": "Error message"
}

πŸ”§ Technical Details

  • Minimum Android API level: 30 (Android 11.0)
  • Uses Android Accessibility Service API
  • Implements custom drawing overlay using Window Manager
  • Supports multi-window environments
  • Built with Kotlin

πŸ”„ Continuous Integration

This project uses GitHub Actions for automated building and releasing.

πŸ“¦ Automated Builds

Every push to the main branch or pull request will trigger the build workflow that:

  • Builds the Android app
  • Creates the APK
  • Uploads the APK as an artifact in the GitHub Actions run

About

Automate your mobile devices with natural language commands - the counterpart android app for the mobilerun framework

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors