#!/bin/bash # deploy.sh: build the APK, install it on the TV over wireless adb and # launch it. Finds the TV through its _adb-tls-connect mDNS record when no # device is connected; wireless debugging must be on (it turns off on reboot). # # Copyright (C) 2026 Danilo M. # # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License version 2 as published # by the Free Software Foundation. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License # for more details. set -euo pipefail cd "$(dirname "$0")" pkg=mygram.droid apk=app/build/outputs/apk/debug/mygram-droid-debug.apk if ! adb get-state >/dev/null 2>&1; then addr=$(avahi-browse -rtp _adb-tls-connect._tcp 2>/dev/null | awk -F';' '/^=/ && $3 == "IPv4" {print $8 ":" $9; exit}') [ -n "$addr" ] || { echo "no device: set ANDROID_SERIAL or enable wireless debugging" >&2; exit 1; } adb connect "$addr" >/dev/null export ANDROID_SERIAL=$addr fi ./build.sh adb install -r "$apk" adb shell -n am start -n "$pkg/.MainActivity" >/dev/null echo "deployed to ${ANDROID_SERIAL:-$(adb get-serialno)}"