> ## Documentation Index
> Fetch the complete documentation index at: https://docs.opencompany.sh/llms.txt
> Use this file to discover all available pages before exploring further.

# Android Nodes

> 16 nodes for Android device automation

# Android Nodes

Control and monitor Android devices with 16 specialized nodes.

## Connection Setup

Android device connection is configured in the **Credentials modal** (Android panel), not on the workflow nodes themselves. Once a device is connected there, every Android service node in your workflow uses that connection.

There are two connection methods:

<Tabs>
  <Tab title="Remote Relay (QR pairing)">
    The recommended method. Open the Credentials modal, choose the Android panel, and click **Connect**. A QR code appears - scan it with the companion Android app to pair the device.

    The relay uses a two-state model:

    * **Connected** - the WebSocket connection to the relay server is active. A QR code is available for pairing.
    * **Paired** - an Android device has scanned the QR and is paired through the relay.

    Android service nodes require the device to be **paired** to execute (the node status indicator shows green when paired, red otherwise). If the device disconnects while the relay stays connected, a new QR is shown so you can re-pair.
  </Tab>

  <Tab title="Local ADB">
    Connect a device over USB with ADB. MachinaOs sets up ADB port forwarding automatically so the backend can reach the device.

    Requirements:

    * USB debugging enabled in Developer options
    * `adb` available on your PATH
  </Tab>
</Tabs>

<Info>
  Connection is set up once in the Credentials modal. The service nodes below carry only their action and parameters - no connection fields.
</Info>

***

## System Monitoring (4 nodes)

### Battery Monitor

Monitor battery status and health.

**Actions:** get\_status

**Output:**

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

### Network Monitor

Check network connectivity.

**Actions:** get\_status

**Output:**

```json theme={null}
{
  "is_connected": true,
  "type": "wifi",
  "wifi_ssid": "MyNetwork",
  "is_internet_available": true,
  "ip_address": "192.168.1.100",
  "signal_strength": -45
}
```

### System Info

Get device information.

**Actions:** get\_info

**Output:**

```json theme={null}
{
  "device_model": "Pixel 7",
  "manufacturer": "Google",
  "android_version": "14",
  "api_level": 34,
  "total_memory": 8192,
  "available_memory": 4096,
  "total_storage": 128000,
  "available_storage": 64000
}
```

### Location

Get GPS location.

**Actions:** get\_location

**Output:**

```json theme={null}
{
  "latitude": 37.7749,
  "longitude": -122.4194,
  "accuracy": 10.5,
  "altitude": 15.2,
  "provider": "gps",
  "timestamp": "2024-01-15T10:30:00Z"
}
```

***

## App Management (2 nodes)

### App Launcher

Launch applications by package name.

<ParamField path="package_name" type="string" required>
  App package name (e.g., com.spotify.music)
</ParamField>

**Output:**

```json theme={null}
{
  "success": true,
  "package": "com.spotify.music",
  "message": "App launched"
}
```

**Common Package Names:**

| App      | Package                    |
| -------- | -------------------------- |
| Chrome   | com.android.chrome         |
| YouTube  | com.google.android.youtube |
| Spotify  | com.spotify.music          |
| WhatsApp | com.whatsapp               |
| Gmail    | com.google.android.gm      |

### App List

Get installed applications.

**Output:**

```json theme={null}
{
  "apps": [
    {
      "name": "Chrome",
      "package": "com.android.chrome",
      "version": "120.0.6099.230"
    }
  ],
  "count": 150
}
```

***

## Automation (6 nodes)

### WiFi Automation

Control WiFi settings.

**Actions:** enable, disable, get\_status, scan

**Output (scan):**

```json theme={null}
{
  "networks": [
    {
      "ssid": "MyNetwork",
      "bssid": "00:11:22:33:44:55",
      "signal": -45,
      "security": "WPA2"
    }
  ]
}
```

### Bluetooth Automation

Control Bluetooth settings.

**Actions:** enable, disable, get\_status, get\_paired\_devices

**Output (paired devices):**

```json theme={null}
{
  "devices": [
    {
      "name": "AirPods Pro",
      "address": "AA:BB:CC:DD:EE:FF",
      "type": "audio"
    }
  ]
}
```

### Audio Automation

Control volume and audio.

**Actions:** get\_volume, set\_volume, mute, unmute

<ParamField path="volume_level" type="slider">
  Volume level 0-100 (for set\_volume)
</ParamField>

<ParamField path="stream_type" type="select" default="media">
  Stream: media, ringtone, notification, alarm
</ParamField>

### Device State Automation

Control device states.

**Actions:** get\_state, set\_airplane\_mode, set\_power\_save

<ParamField path="enabled" type="boolean">
  Enable or disable the feature
</ParamField>

### Screen Control Automation

Control display settings.

**Actions:** get\_brightness, set\_brightness, wake\_screen, set\_timeout

<ParamField path="brightness" type="slider">
  Brightness level 0-255
</ParamField>

<ParamField path="auto_brightness" type="boolean">
  Enable automatic brightness
</ParamField>

### Airplane Mode Control

Toggle airplane mode.

**Actions:** get\_status, enable, disable

***

## Sensors (2 nodes)

### Motion Detection

Access motion sensors.

**Actions:** get\_accelerometer, get\_gyroscope, detect\_shake

**Output (accelerometer):**

```json theme={null}
{
  "x": 0.15,
  "y": 9.78,
  "z": 0.23,
  "timestamp": "2024-01-15T10:30:00Z"
}
```

### Environmental Sensors

Access environmental sensors.

**Actions:** get\_light, get\_pressure, get\_temperature, get\_humidity

**Output:**

```json theme={null}
{
  "light": 350,
  "pressure": 1013.25,
  "temperature": 22.5,
  "humidity": 45
}
```

<Info>
  Not all devices have all sensors. Output will indicate unavailable sensors.
</Info>

***

## Media (2 nodes)

### Camera Control

Control camera functions.

**Actions:** get\_info, take\_photo

<ParamField path="camera_id" type="select" default="back">
  Camera to use: back, front
</ParamField>

**Output (get\_info):**

```json theme={null}
{
  "cameras": [
    {
      "id": "0",
      "facing": "back",
      "megapixels": 50
    },
    {
      "id": "1",
      "facing": "front",
      "megapixels": 12
    }
  ]
}
```

### Media Control

Control media playback.

**Actions:** play, pause, next, previous, get\_volume, set\_volume

***

## Example Workflows

### Battery Alert

```
[Cron (hourly)] --> [Battery Monitor] --> [Python] --> [WhatsApp Send]
```

**Python:**

```python theme={null}
level = input_data.get("level", 100)
if level < 20:
    output = {"alert": True, "msg": f"Battery: {level}%"}
else:
    output = {"alert": False}
```

### WiFi Toggle via Webhook

```
[Webhook Trigger] --> [WiFi Automation]
```

**Webhook path:** `/wifi`
**WiFi Action:** `{{webhookTrigger.body.action}}`

```bash theme={null}
curl -X POST http://localhost:3010/webhook/wifi \
  -d '{"action": "enable"}'
```

### Morning Routine

```
[Cron (7:00 AM)] --> [WiFi Enable] --> [App Launcher (News)]
                          |
                          v
                    [Audio: Vol 50%]
```

***

## Troubleshooting

<Accordion title="Device not detected">
  ```bash theme={null}
  # Check ADB connection
  adb devices

  # Restart ADB
  adb kill-server
  adb start-server
  ```
</Accordion>

<Accordion title="Permission denied">
  Some features require:

  * USB debugging enabled
  * Developer options enabled
  * Specific app permissions
</Accordion>

<Accordion title="Remote relay issues">
  * Open the Credentials modal (Android panel) and check the status: the device must be **paired**, not just **connected**
  * If only connected, re-scan the QR code with the companion app to pair
  * Ensure the companion Android app is running on the device
  * Use Reconnect in the Android panel if the relay connection dropped
</Accordion>

***

## Related

<CardGroup cols={2}>
  <Card title="Android Tutorial" icon="mobile" href="/tutorials/android-automation">
    Step-by-step guide
  </Card>

  <Card title="Webhooks" icon="webhook" href="/nodes/webhooks">
    Trigger Android actions via HTTP
  </Card>
</CardGroup>
