$env:JAVA_HOME    = "D:\Program Files\Android\Android Studio\jbr"
$env:ANDROID_HOME = "D:\ProgramData\AndroidSdk"
$env:PATH         = "$env:JAVA_HOME\bin;$env:ANDROID_HOME\platform-tools;$env:PATH"

# Force Gradle to flush output line-by-line (no buffering)
$env:GRADLE_OPTS  = "-Dorg.gradle.console=plain -Dorg.gradle.logging.level=lifecycle"
# Force Node/Metro color output
$env:FORCE_COLOR  = "1"

Write-Host "================================" -ForegroundColor Cyan
Write-Host " TEM Receiver - Run on Android" -ForegroundColor Cyan
Write-Host "================================`n" -ForegroundColor Cyan

Write-Host "[1/2] ADB devices:" -ForegroundColor Yellow
adb devices
Write-Host ""

Write-Host "[2/2] Building & launching (Metro will start after install)..." -ForegroundColor Yellow
Write-Host "--------------------------------------------------------------`n" -ForegroundColor DarkGray

Set-Location $PSScriptRoot

# & ensures stdout/stderr stream to console in real time
& npx expo run:android

Write-Host "`nExited." -ForegroundColor DarkGray
