who_need_help/android/README.md

71 lines
2.2 KiB
Markdown

# Who Need Help for Android
This module is a native Android WebView shell for the Phoenix application. It
keeps authentication cookies, LiveView WebSockets, MapLibre, chat, and
foreground geolocation in the same trusted origin.
## Verified build configuration
- Android Gradle Plugin 9.3.0
- Gradle 9.6.1
- compileSdk / targetSdk 37
- Build Tools 37.0.0
- Java source and bytecode level 17
- minSdk 24 (project baseline, not an Android SDK requirement)
The debug origin is not stored in the Dockerfile or Gradle project. Set
`WNH_DEBUG_BASE_URL` in the repository's ignored `.env` file. The supplied
local configuration uses loopback together with `adb reverse`; debug builds
allow cleartext traffic, while the WebView still restricts in-app navigation to
that one configured origin.
Release builds do not have a default server. Supply the real HTTPS deployment:
```sh
./gradlew :app:assembleRelease \
-PWNH_BASE_URL=https://help.your-domain.example
```
The build rejects a missing, HTTP, credentialed, query-bearing, or
fragment-bearing release URL.
## Reproducible Docker build
From the repository root:
```sh
./scripts/android-build.sh
sha256sum android/dist/who-need-help-debug.apk
```
The Docker build runs JVM unit tests, Android lint, and `assembleDebug` before it
exports the APK and lint report.
## Emulator verification
The optional `emulator` target contains the API 37.0 Google APIs x86_64 system
image. It requires KVM and host networking. Pass the same `.env` value as a
build argument, then expose the Compose proxy to Android with `adb reverse`:
```sh
set -a
. ./.env
set +a
docker build \
--build-arg "WNH_DEBUG_BASE_URL=$WNH_DEBUG_BASE_URL" \
--target emulator \
-t who-need-help-android:emulator \
android
docker run --rm --name who-need-help-android-emulator \
--device /dev/kvm \
--network host \
who-need-help-android:emulator
docker exec who-need-help-android-emulator adb reverse tcp:4010 tcp:4010
docker exec who-need-help-android-emulator adb install \
/opt/who-need-help/who-need-help-debug.apk
```
The application ID `org.whoneedhelp.mobile` is provisional until the publishing
identity and store listing are chosen. Changing it after publication creates a
different Android application.