Dashboard URL and label configured in dashboards.yaml; each entry becomes a product flavor with BuildConfig.DASHBOARD_URL injected at build time. APKs output as <flavor>-release.apk.
2.9 KiB
android-webview-kiosk
Android TV app: fullscreen WebView showing a configurable Grafana dashboard.
Multiple APK flavors built from dashboards.yaml (repo root) — one APK per entry.
Runs on the living-room Sony Bravia KD-65XE9305 (Android 8.0, API 26;
Android System WebView updates independently via Play Store — currently v138).
Launched remotely through the Bravia REST IP-control API by Control4
(driver lives in a separate project). See README.md for the API sequence.
Lab project — with deviations
This is a lab project (lab skill conventions apply) EXCEPT:
- No container image, no helm chart, no /livez//readyz — artifact is an APK.
- No
nix build: gradle needs network for Maven deps. The flake is a dev shell only. All builds run asnix develop --command gradle .... - Agents cannot run nix/gradle/adb here — ask the user to run commands and report output.
NixOS aapt2 workaround
AGP cannot run the Maven-downloaded aapt2 on NixOS (dynamically linked
generic Linux binary). The nix shellHook rewrites the
android.aapt2FromMavenOverride line in gradle.properties to point at
the SDK's nix-patched aapt2 on every nix develop. The sentinel value
__NIX_SHELLHOOK_SETS_THIS__ is what's tracked in git; the shellHook
replaces it before any gradle command runs.
Commands (user-run, from repo root)
- Tests:
nix develop --command gradle --no-daemon :app:testWeatherReleaseUnitTest - All APKs:
nix develop --command gradle --no-daemon :app:assembleRelease→app/build/outputs/apk/<flavor>/release/<flavor>-release.apk - Single APK:
nix develop --command gradle --no-daemon :app:assembleWeatherRelease - Sideload:
adb connect <tv-ip>:5555 && adb install -r <apk>(bumpversionCodein app/build.gradle.kts first for upgrades) - Fresh install:
adb uninstall cz.c3c.webviewkiosk && adb install <apk>
Key facts
- Package/applicationId:
cz.c3c.webviewkiosk; repo name keeps theandroid-prefix, the package can't (hyphens illegal). - Dashboard URL + label configured in
dashboards.yaml(repo root). Each entry becomes a product flavor;BuildConfig.DASHBOARD_URLis injected at build time. Changing a URL means editing the YAML, rebuilding, resideloading. Intentional: keeps Control4 integration to a single parameterless launch call. signing/release.keystoreis committed on purpose (private repo, LAN-only kiosk) so every build is upgrade-compatible. Don't reuse the key.- minSdk 26 is a hard floor — the TV never gets newer Android.
LEANBACK_LAUNCHERcategory +android:bannerare what make the app visible to the Bravia API'sgetApplicationList/setActiveApp. Don't remove either.- App URI (from
getApplicationList):com.sony.dtv.cz.c3c.webviewkiosk.cz.c3c.webviewkiosk.MainActivity setActiveAppalone wakes the TV from standby — no separatesetPowerStatuscall needed. Control4 driver can skip the wake step.