Skip to content

Automation

ars edited this page Oct 21, 2026 · 9 revisions

Automation Guide

Maximize your convenience by automating the start and connection process.

1. Using Wireless Helper (Easiest)

The simplest way to automate the connection is using our companion app: Wireless Helper

  1. Select your Car's Bluetooth device in the app.
  2. Set Auto-Start to "On Bluetooth Connection".
  3. The app will automatically wake up and trigger Android Auto as soon as your phone connects to your car.

2. Headless Operation (Helper Mode)

If you use Wireless Mode: Helper Mode (Settings -> General), Open Headunit runs a background service on the tablet.

  • The service listens for connection requests from your phone.
  • Once a request is received, the app pops up automatically.
  • Tip: Whitelist Open Headunit in your tablet's "Battery Optimization" or "Auto-Start" settings.

3. Power Users: Tasker / MacroDroid / App Shortcuts

You can trigger actions using Android Intents or the new App Shortcuts (v1.15.0+).

App Shortcuts (Easiest for Samsung Modes & Routines)

Open Headunit supports static shortcuts that are automatically detected by system automation tools:

  • Connect: Automatically connects to the last known device.
  • Disconnect: Safely ends the current session.
  • Exit App: Safely ends the session, stops all background services, and completely closes the app.
  • Mode: Day / Night / Auto: Directly controls the display theme.

3. Broadcast Intents (v3.4.0+ Recommended)

Starting with v3.4.0, Open Headunit provides a dedicated Broadcast Receiver (AutomationReceiver). Sending commands as a broadcast eliminates background activity start restrictions on Android 10+ and allows automation apps like Tasker and MacroDroid to operate without needing the "Display over other apps" permission.

  • Package: com.andrerinas.headunitrevived
  • Receiver Class: com.andrerinas.openheadunit.automation.AutomationReceiver
  • Action Prefix: com.andrerinas.openheadunit. (legacy prefix com.andrerinas.headunitrevived. is also supported as an alias)

Available Actions

Action (com.andrerinas.openheadunit.) Extras Description
ACTION_CONNECT ip (String, optional), no_ui (Boolean) Connects to Android Auto. If ip is specified, opens session to head unit server on port 5277. Without ip, checks USB.
ACTION_DISCONNECT Safely ends the active projection session.
ACTION_END_SESSION_STAY_ARMED (New in 3.5.0) Ends projection session but leaves the wireless network / WiFi Direct group up so the phone can reconnect automatically.
ACTION_START_SELF_MODE no_ui (Boolean) Starts Self-Mode (projects device onto itself).
ACTION_STOP_SERVICE Ends session and stops all background services. ACTION_EXIT is an accepted alias.
ACTION_SET_NIGHT_MODE state (day, night, or auto) Directly switches UI theme.
ACTION_QUERY_STATE Queries current projection state (returns JSON via ordered broadcast reply).
ACTION_START_WIRELESS Arms the configured wireless mode.
ACTION_STOP_WIRELESS Stops wireless listening mode.
ACTION_CANCEL_WIRELESS (New in 3.5.0) Cancels wireless bring-up and keeps it down (equivalent to tapping the status pill's cancel icon).
ACTION_START_WIRELESS_SCAN Initiates a single wireless network discovery pass.
ACTION_NATIVE_AA_POKE extra_mac (String, optional) (New in 3.5.0) Wakes the specified phone over Bluetooth for Native AA. When extra_mac is omitted, triggers the WiFi connection on external-module units.
ACTION_NATIVE_AA_CANCEL_POKE (New in 3.5.0) Cancels a Native AA wake attempt in progress.
ACTION_CHECK_USB Triggers an immediate USB accessory check and clears any transient dismiss state.
ACTION_REFRESH_SENSORS Refreshes and re-sends sensor data to Android Auto (legacy alias: ...aap.action.REFRESH_SENSORS).
ACTION_RESTART_AUDIO Restarts and flushes audio sinks (legacy alias: ...aap.action.RESTART_AUDIO).
ACTION_RAISE_PROJECTION Brings the active projection activity back to foreground (legacy alias: ...aap.action.RAISE_PROJECTION).

Note: Remote configuration actions (ACTION_SET_SETTINGS, ACTION_GET_SETTINGS, ACTION_RESET_SETTINGS, ACTION_EXPORT_LOG, etc.) require the "Allow external configuration" toggle to be enabled in Settings → Developer Diagnostics. Sensitive credentials (Wi-Fi passwords, BSSID overrides) are strictly withheld from exports.

4. URI Schemes & Activity Intents

For launcher shortcuts, simple Tasker tasks, or browser links, the standard activity deep-links remain fully supported:

Useful URIs

Purpose URI
Connect to IP headunit://connect?ip=192.168.x.x
Connect (Last Device) headunit://connect
Disconnect Session headunit://disconnect
Exit App headunit://exit
Set Night Mode headunit://nightmode?state=day|night|auto

ADB Examples

# Broadcast connect to phone IP
adb shell am broadcast \
  -n com.andrerinas.headunitrevived/com.andrerinas.openheadunit.automation.AutomationReceiver \
  -a com.andrerinas.openheadunit.ACTION_CONNECT \
  --es ip "192.168.1.25"

# Query current connection state
adb shell am broadcast \
  -n com.andrerinas.headunitrevived/com.andrerinas.openheadunit.automation.AutomationReceiver \
  -a com.andrerinas.openheadunit.ACTION_QUERY_STATE

# Set night mode via activity deep-link
adb shell am start -a android.intent.action.VIEW -d "headunit://nightmode?state=night"

# Exit app via deep-link
adb shell am start -a android.intent.action.VIEW -d "headunit://exit"

Clone this wiki locally