Skip to main content

Android Automation

MachinaOs can control Android devices for automation tasks like launching apps, monitoring battery, controlling WiFi, and more.

Connection Methods

MethodUse Case
Local ADBDevice connected via USB to your machine
Remote RelayDevice connected via WebSocket relay server

Set Up Connection

Android device connection is configured in the Credentials Modal (Android panel), not via a workflow node. Open Credentials and pick one of the two methods below.

Option A: Local ADB

  1. Enable Developer Options on your Android device
  2. Enable USB Debugging
  3. Connect device via USB
  4. Run adb devices to verify connection
  5. In the Credentials Modal, open the Android panel and choose Local ADB (ADB port forwarding is set up for you)

Option B: Remote Relay

  1. Open the Credentials Modal and select the Android panel
  2. Click Connect to start the relay connection
  3. Scan the QR code with the companion Android app to pair your device
Remote relay allows controlling devices anywhere with internet access. The relay uses a two-state model: connected (relay WebSocket is up) versus paired (a device has scanned the QR and is ready to run actions). Android nodes require a paired device to execute.

Available Android Nodes

MachinaOs ships 16 Android service nodes across monitoring, apps, automation, sensors, and media. Each one can run as a standalone workflow node or be connected to an AI agent’s tools handle.

System Monitoring

NodeDescription
Battery MonitorBattery level, charging status, temperature
Network MonitorWiFi/cellular status, internet connectivity
System InfoDevice model, Android version, memory
LocationGPS coordinates, accuracy, provider

App Management

NodeDescription
App LauncherLaunch apps by package name
App ListGet installed applications

Automation

NodeDescription
WiFi AutomationEnable/disable WiFi, scan networks
Bluetooth AutomationToggle Bluetooth, list paired devices
Audio AutomationVolume control, mute/unmute
Device StateAirplane mode, brightness, screen
Screen ControlWake screen, timeout settings
Airplane ModeAirplane mode status and control

Sensors

NodeDescription
Motion DetectionAccelerometer, gyroscope, shake detection
Environmental SensorsTemperature, humidity, pressure, light

Media

NodeDescription
CameraTake photos, get camera info
Media ControlPlayback control, volume

Example: Battery Alert Workflow

Create a workflow that sends an alert when battery is low.

Workflow Design

[Cron Scheduler] --> [Battery Monitor] --> [Python Executor] --> [WhatsApp Send]
                                               (check level)

Step 1: Add Cron Trigger

Cron Expression: */10 * * * *  (every 10 minutes)

Step 2: Add Battery Monitor

Action: Get Status

Step 3: Add Python Executor

battery_level = input_data.get("level", 100)
is_charging = input_data.get("is_charging", False)

if battery_level < 20 and not is_charging:
    output = {
        "alert": True,
        "message": f"Battery low: {battery_level}%"
    }
else:
    output = {"alert": False}

Step 4: Add WhatsApp Send (conditional)

Phone Number: +1234567890
Message: {{pythonExecutor.message}}

Example: App Launcher Workflow

Launch an app when receiving a webhook.
[Webhook Trigger] --> [App Launcher]
App Launcher Config:
Package Name: {{webhookTrigger.body.app}}
Test:
curl -X POST http://localhost:3010/webhook/launch \
  -H "Content-Type: application/json" \
  -d '{"app": "com.spotify.music"}'

Example: WiFi Toggle

[Webhook Trigger] --> [WiFi Automation]
WiFi Automation Config:
Action: {{webhookTrigger.body.action}}
Test:
# Enable WiFi
curl -X POST http://localhost:3010/webhook/wifi \
  -d '{"action": "enable"}'

# Disable WiFi
curl -X POST http://localhost:3010/webhook/wifi \
  -d '{"action": "disable"}'

Battery Monitor Output

{
  "level": 85,
  "is_charging": true,
  "status": "charging",
  "plugged": "ac",
  "temperature": 28.5,
  "health": "good",
  "technology": "Li-ion"
}

Network Monitor Output

{
  "is_connected": true,
  "type": "wifi",
  "wifi_ssid": "MyNetwork",
  "is_internet_available": true,
  "ip_address": "192.168.1.100"
}

Troubleshooting

  • Run adb devices to check connection
  • Ensure USB debugging is enabled
  • Try different USB cable/port
  • Restart ADB: adb kill-server && adb start-server
  • Verify relay URL is correct
  • Check API key is valid
  • Ensure companion app is installed on device
  • Check firewall settings
  • Some actions require root access
  • Use device automation apps for restricted features
  • Check Android version compatibility

Tips

Start with Battery Monitor and System Info to verify your connection works before building complex workflows.
Use meaningful node names (F2 to rename) when building workflows with multiple Android nodes.

Next Steps

Android Node Reference

Full documentation for all 16 Android nodes

Webhooks

Trigger Android actions via HTTP