mirror of
https://github.com/hanzoai/bot.git
synced 2026-10-30 17:24:26 +00:00
5.2 KiB
5.2 KiB
Hanzo Bot Node (Android) (internal)
Modern Android node app: connects to the Gateway WebSocket (_bot-gw._tcp) and exposes Canvas + Chat + Camera.
Notes:
- The node keeps the connection alive via a foreground service (persistent notification with a Disconnect action).
- Chat always uses the shared session key
main(same session across iOS/macOS/WebChat/Android). - Supports modern Android only (
minSdk 31, Kotlin + Jetpack Compose).
Rebuild Checklist
- New 4-step onboarding flow
- Connect tab with
Setup Code+Manualmodes - Encrypted persistence for gateway setup/auth state
- Chat UI restyled
- Settings UI restyled and de-duplicated (gateway controls moved to Connect)
- QR code scanning in onboarding
- Performance improvements
- Streaming support in chat UI
- Request camera/location and other permissions in onboarding/settings flow
- Push notifications for gateway/chat status updates
- Security hardening (biometric lock, token handling, safer defaults)
- Voice tab full functionality
- Screen tab full functionality
- Full end-to-end QA and release hardening
Open in Android Studio
- Open the folder
apps/android.
Build / Run
cd apps/android
./gradlew :app:assembleDebug
./gradlew :app:installDebug
./gradlew :app:testDebugUnitTest
Kotlin Lint + Format
pnpm android:lint
pnpm android:format
Android framework/resource lint (separate pass):
pnpm android:lint:android
Direct Gradle tasks:
cd apps/android
./gradlew :app:ktlintCheck :benchmark:ktlintCheck
./gradlew :app:ktlintFormat :benchmark:ktlintFormat
./gradlew :app:lintDebug
gradlew auto-detects the Android SDK at ~/Library/Android/sdk (macOS default) if ANDROID_SDK_ROOT / ANDROID_HOME are unset.
Connect / Pair
- Start the gateway (on your “master” machine):
pnpm hanzo-bot gateway --port 18789 --verbose
- In the Android app:
- Open Settings
- Either select a discovered gateway under Discovered Gateways, or use Advanced → Manual Gateway (host + port).
- Approve pairing (on the gateway machine):
hanzo-bot nodes pending
hanzo-bot nodes approve <requestId>
More details: docs/platforms/android.md.
Permissions
- Discovery:
- Android 13+ (
API 33+):NEARBY_WIFI_DEVICES - Android 12 and below:
ACCESS_FINE_LOCATION(required for NSD scanning)
- Android 13+ (
- Foreground service notification (Android 13+):
POST_NOTIFICATIONS - Camera:
CAMERAforcamera.snapandcamera.clipRECORD_AUDIOforcamera.clipwhenincludeAudio=true
Integration Capability Test (Preconditioned)
This suite assumes setup is already done manually. It does not install/run/pair automatically.
Pre-req checklist:
- Gateway is running and reachable from the Android app.
- Android app is connected to that gateway and
bot nodes statusshows it as paired + connected. - App stays unlocked and in foreground for the whole run.
- Open the app Screen tab and keep it active during the run (canvas/A2UI commands require the canvas WebView attached there).
- Grant runtime permissions for capabilities you expect to pass (camera/mic/location/notification listener/location, etc.).
- No interactive system dialogs should be pending before test start.
- Canvas host is enabled and reachable from the device (do not run gateway with
BOT_SKIP_CANVAS_HOST=1; startup logs should includecanvas host mounted at .../__bot__/). - Local operator test client pairing is approved. If first run fails with
pairing required, approve latest pending device pairing request, then rerun: - For A2UI checks, keep the app on Screen tab; the node now auto-refreshes canvas capability once on first A2UI reachability failure (TTL-safe retry).
bot devices list
bot devices approve --latest
Run:
pnpm android:test:integration
Optional overrides:
BOT_ANDROID_GATEWAY_URL=ws://...(default: from your local Bot config)BOT_ANDROID_GATEWAY_TOKEN=...BOT_ANDROID_GATEWAY_PASSWORD=...BOT_ANDROID_NODE_ID=...orBOT_ANDROID_NODE_NAME=...
What it does:
- Reads
node.describecommand list from the selected Android node. - Invokes advertised non-interactive commands.
- Skips
screen.recordin this suite (Android requires interactive per-invocation screen-capture consent). - Asserts command contracts (success or expected deterministic error for safe-invalid calls like
sms.send,notifications.actions,app.update).
Common failure quick-fixes:
pairing requiredbefore tests start:- approve pending device pairing (
bot devices approve --latest) and rerun.
- approve pending device pairing (
A2UI host not reachable/A2UI_HOST_NOT_CONFIGURED:- ensure gateway canvas host is running and reachable, keep the app on the Screen tab. The app will auto-refresh canvas capability once; if it still fails, reconnect app and rerun.
NODE_BACKGROUND_UNAVAILABLE: canvas unavailable:- app is not effectively ready for canvas commands; keep app foregrounded and Screen tab active.
Contributions
This Android app is currently being rebuilt. Maintainer: @obviyus. For issues/questions/contributions, please open an issue or reach out on Discord.