Files
alarm-client/scripts/android.sh
T
2026-10-18 22:42:00 +01:00

26 lines
1.1 KiB
Bash
Executable File

#!/usr/bin/env bash
# Dev launcher for the Alarm client.
#
# Expects metro already running on 127.0.0.1:8089 (start it with `bun start`
# in another terminal). Reverses the adb tunnels so the device reaches the
# dev machine via 127.0.0.1, then builds, installs and launches the app:
# - 8080 Maestro (dev default)
# - 8088 Alarm direct mode (bypasses Maestro) — the service's host port
# - 8089 the Metro packager (this client's port)
# Each reverse maps device 127.0.0.1:<port> -> host 127.0.0.1:<port>, so Metro
# and the service must keep distinct numbers; 8088 belongs to the service.
#
# If your phone is on the same LAN instead, turn "Use adb reverse" off in
# Settings and it will fall back to the LAN host baked into src/services/connection.ts.
set -euo pipefail
for port in 8080 8088 8089; do
adb reverse tcp:"$port" tcp:"$port" >/dev/null 2>&1 || true
done
if ! curl -sf http://127.0.0.1:8089/status >/dev/null 2>&1; then
echo "WARNING: metro is not running on :8089. Start it first with: bun start"
fi
exec bunx react-native run-android --port 8089 --no-packager