|
| 1 | +# Android Build Plan – VisionClaw |
| 2 | + |
| 3 | +This document reviews the current iOS setup and outlines **options for creating an Android build** of VisionClaw, with effort, reuse, and trade-offs. |
| 4 | + |
| 5 | +--- |
| 6 | + |
| 7 | +## 1. Current iOS Architecture (Summary) |
| 8 | + |
| 9 | +| Layer | iOS implementation | Android equivalent | |
| 10 | +|-------|--------------------|--------------------| |
| 11 | +| **Glasses / camera** | Meta Wearables DAT (MWDATCore, MWDATCamera) – Swift | [Meta Wearables DAT Android](https://github.com/facebook/meta-wearables-dat-android) – Kotlin | |
| 12 | +| **AI / voice** | Gemini Live API over WebSocket | Same API (platform-agnostic) | |
| 13 | +| **Agentic actions** | OpenClaw gateway (HTTP + WebSocket) | Same (platform-agnostic) | |
| 14 | +| **Optional video call** | WebRTC (PiP, signaling) | WebRTC Android (e.g. webrtc.org) | |
| 15 | +| **UI** | SwiftUI | Jetpack Compose (or XML) | |
| 16 | +| **Phone camera fallback** | iPhone camera → frames to Gemini | CameraX / Camera2 → frames to Gemini | |
| 17 | +| **Settings / QR** | SwiftUI, AVFoundation QR | Compose, ML Kit / ZXing QR | |
| 18 | + |
| 19 | +**Reusable as-is on Android** |
| 20 | + |
| 21 | +- Gemini Live: same WebSocket URL, auth, JSON protocol. |
| 22 | +- OpenClaw: same host/port/tokens, same tool-call JSON. |
| 23 | +- Server (e.g. `samples/CameraAccess/server`): no change for Android. |
| 24 | + |
| 25 | +**Platform-specific** |
| 26 | + |
| 27 | +- Meta DAT (glasses streaming, registration, permissions): use [meta-wearables-dat-android](https://github.com/facebook/meta-wearables-dat-android) on Android. |
| 28 | +- UI, navigation, camera capture, audio: reimplement in Kotlin/Compose (or chosen stack). |
| 29 | +- Secrets/config: Android `BuildConfig` / `local.properties` / same env-based approach as CI. |
| 30 | + |
| 31 | +--- |
| 32 | + |
| 33 | +## 2. Option A: Native Android (Kotlin + Jetpack Compose) – **Recommended** |
| 34 | + |
| 35 | +**Idea:** Build an Android app that mirrors the iOS structure: same features (glasses + phone camera, Gemini Live, OpenClaw, optional WebRTC), using the official Meta Android DAT and the same backend contracts. |
| 36 | + |
| 37 | +**Pros** |
| 38 | + |
| 39 | +- Direct use of [Meta Wearables DAT Android](https://github.com/facebook/meta-wearables-dat-android) (video, audio, registration, permissions), aligned with current iOS DAT usage. |
| 40 | +- Same Gemini Live and OpenClaw integration (copy protocol and message shapes; reimplement only transport and threading in Kotlin). |
| 41 | +- No cross-platform framework lock-in; each platform can follow its own best practices and SDKs. |
| 42 | +- Fits existing CI style: add an `android-build.yml` (Gradle, APK/AAB), similar to `ios-build.yml`. |
| 43 | +- Clear path for “Android phone mode” (CameraX → send frames to Gemini) analogous to iPhone mode. |
| 44 | + |
| 45 | +**Cons** |
| 46 | + |
| 47 | +- Full reimplementation of UI and app flow in Kotlin/Compose (no code reuse from Swift). |
| 48 | +- Two codebases to maintain (iOS + Android); shared logic only in docs, API contracts, and server. |
| 49 | + |
| 50 | +**Effort (rough)** |
| 51 | + |
| 52 | +- **Core path (glasses + Gemini + OpenClaw):** ~3–6 weeks for one experienced Android dev (registration, streaming, Gemini WebSocket client, OpenClaw HTTP/WS, settings, QR). |
| 53 | +- **Phone camera mode + polish:** +1–2 weeks. |
| 54 | +- **WebRTC (if desired):** +1–2 weeks (signaling already exists; integrate webrtc.org on Android). |
| 55 | + |
| 56 | +**Reuse** |
| 57 | + |
| 58 | +- 100% of “backend” design: Gemini Live protocol, OpenClaw tool-call format, server. |
| 59 | +- 0% of UI/native code (by design). |
| 60 | + |
| 61 | +--- |
| 62 | + |
| 63 | +## 3. Option B: Flutter (Dart) |
| 64 | + |
| 65 | +**Idea:** One Flutter app for iOS and Android; use platform channels to call the native Meta DAT on each side (iOS Swift, Android Kotlin). |
| 66 | + |
| 67 | +**Pros** |
| 68 | + |
| 69 | +- Single UI codebase (Dart/Widgets). |
| 70 | +- Shared business logic in Dart (Gemini client, OpenClaw client, config, tool parsing). |
| 71 | +- One repo, one test suite for shared logic. |
| 72 | + |
| 73 | +**Cons** |
| 74 | + |
| 75 | +- Meta DAT is **native-only** (Swift + Kotlin). You must: |
| 76 | + - Maintain Flutter plugin(s) that wrap [meta-wearables-dat-ios](https://github.com/facebook/meta-wearables-dat-ios) and [meta-wearables-dat-android](https://github.com/facebook/meta-wearables-dat-android), or depend on a community one if it exists and is kept up to date. |
| 77 | +- Current iOS app is deeply Swift/SwiftUI; porting to Flutter is a full rewrite of the existing app, not an “add Android” step. |
| 78 | +- Debugging spans Dart + native (iOS/Android); CI needs both Xcode and Gradle. |
| 79 | + |
| 80 | +**Effort** |
| 81 | + |
| 82 | +- **Larger than Option A for “first Android-capable version”:** Flutter app from scratch + two native DAT plugins (or one dual-platform plugin) + Gemini/OpenClaw in Dart. Estimate ~2–3 months for parity with current iOS, then Android “for free” from the same app. |
| 83 | + |
| 84 | +**Reuse** |
| 85 | + |
| 86 | +- After rewrite: UI and app logic shared; only DAT and possibly camera/audio are native behind channels. |
| 87 | + |
| 88 | +--- |
| 89 | + |
| 90 | +## 4. Option C: Kotlin Multiplatform (KMP) |
| 91 | + |
| 92 | +**Idea:** Shared Kotlin code for Gemini Live client, OpenClaw client, and domain models; native UI on both platforms (SwiftUI on iOS, Compose on Android). Android consumes the shared module directly; iOS consumes it via a KMP framework (e.g. Kotlin/Native output). |
| 93 | + |
| 94 | +**Pros** |
| 95 | + |
| 96 | +- Real code reuse: WebSocket handling, JSON parsing, tool-call routing, config validation in one place. |
| 97 | +- iOS keeps SwiftUI; Android uses Compose; only “brain” is shared. |
| 98 | + |
| 99 | +**Cons** |
| 100 | + |
| 101 | +- iOS integration is non-trivial: Kotlin/Native, CocoaPods/SPM wrapper, and ensuring the Gemini/OpenClaw client runs correctly from Swift (threading, callbacks). |
| 102 | +- Current iOS codebase is 100% Swift; introducing KMP means a new build system and dependency story on both sides. |
| 103 | +- Overkill if the shared logic is “just” a few hundred lines of protocol and HTTP/WS glue. |
| 104 | + |
| 105 | +**Effort** |
| 106 | + |
| 107 | +- **Higher than Option A** for getting to a shippable Android app: KMP setup, shared module design, iOS consumption layer, then the Android app. Often 2–4 weeks extra before Android catches up to “Option A starting point.” |
| 108 | + |
| 109 | +**Reuse** |
| 110 | + |
| 111 | +- High for network/domain layer; UI remains native on both. |
| 112 | + |
| 113 | +--- |
| 114 | + |
| 115 | +## 5. Option D: React Native |
| 116 | + |
| 117 | +**Idea:** JavaScript/TypeScript app with native modules for Meta DAT (iOS + Android) and for camera; Gemini and OpenClaw called from JS (fetch/WebSocket). |
| 118 | + |
| 119 | +**Pros** |
| 120 | + |
| 121 | +- One JS codebase for UI and API calls. |
| 122 | +- Large ecosystem and hiring pool. |
| 123 | + |
| 124 | +**Cons** |
| 125 | + |
| 126 | +- Same as Flutter: Meta DAT is native-only; you need (or must build) RN native modules for both platforms. |
| 127 | +- Current app is Swift/SwiftUI; full rewrite to React Native. |
| 128 | +- Debugging and performance tuning across JS bridge and native; CI and release pipeline more involved. |
| 129 | + |
| 130 | +**Effort** |
| 131 | + |
| 132 | +- Similar in spirit to Flutter: full rewrite, then one codebase for both platforms. Typically ~2–3 months for feature parity. |
| 133 | + |
| 134 | +**Reuse** |
| 135 | + |
| 136 | +- After rewrite: UI and non-DAT logic in JS; DAT and possibly camera/audio in native modules. |
| 137 | + |
| 138 | +--- |
| 139 | + |
| 140 | +## 6. CI/CD for Android (applies to any option) |
| 141 | + |
| 142 | +Once you have an Android app (Option A recommended): |
| 143 | + |
| 144 | +- **Workflow:** Add `.github/workflows/android-build.yml`: |
| 145 | + - Checkout, set up JDK (e.g. 17 or 21), run Gradle (assembleRelease or bundleRelease). |
| 146 | + - Optional: run static analysis (e.g. ktlint/Detekt) and fail on violations to keep “zero warnings” policy. |
| 147 | + - Produce **AAB** (Play Store) and/or **APK** (sideload/Testing), upload as artifacts (e.g. retention 30 days, mirroring iOS). |
| 148 | +- **Secrets:** Use GitHub secrets for signing (keystore, passwords) and inject into Gradle (e.g. `local.properties` or env); do not commit keystores. |
| 149 | +- **Runner:** `runs-on: ubuntu-latest` is enough for Gradle; no macOS required for the Android build itself. |
| 150 | + |
| 151 | +This mirrors the structure of `ios-build.yml` (lint → build → artifact) and keeps both platforms consistent. |
| 152 | + |
| 153 | +--- |
| 154 | + |
| 155 | +## 7. Recommendation Summary |
| 156 | + |
| 157 | +| Option | Best for | First Android build | Long-term | |
| 158 | +|--------|----------|----------------------|-----------| |
| 159 | +| **A – Native Android (Kotlin + Compose)** | Fastest path to a real Android app, minimal risk, reuse of design only | **Recommended** | Two codebases; clear and maintainable | |
| 160 | +| **B – Flutter** | Single UI codebase and willingness to rewrite iOS | Rewrite then both platforms | One app, two native DAT integrations | |
| 161 | +| **C – KMP** | Strong need to share protocol/domain code and keep native UI | After KMP + iOS integration | Shared “brain”, native UI both sides | |
| 162 | +| **D – React Native** | Strong JS/React preference and willingness to rewrite | Rewrite then both platforms | One app, native DAT modules | |
| 163 | + |
| 164 | +**Practical path:** Start with **Option A**. Implement an Android app in Kotlin + Compose that: |
| 165 | + |
| 166 | +1. Uses Meta Wearables DAT Android for glasses streaming and registration. |
| 167 | +2. Reuses the same Gemini Live WebSocket protocol and OpenClaw tool-call format (reimplement in Kotlin). |
| 168 | +3. Adds “phone mode” with CameraX feeding frames into the same Gemini pipeline. |
| 169 | +4. Adds `android-build.yml` for build and artifacts. |
| 170 | + |
| 171 | +Then, if you later want more code reuse, you can extract a small shared module (e.g. protocol constants, JSON shapes) into a KMP library or a separate repo consumed by both apps—without committing to a full KMP or Flutter rewrite up front. |
| 172 | + |
| 173 | +--- |
| 174 | + |
| 175 | +## 8. References |
| 176 | + |
| 177 | +- [Meta Wearables DAT Android](https://github.com/facebook/meta-wearables-dat-android) – Ray-Ban glasses on Android. |
| 178 | +- [Meta Wearables Developer – Android](https://wearables.developer.meta.com/docs/build-integration-android/) – Integration and permissions. |
| 179 | +- [Gemini Live API](https://ai.google.dev/gemini-api/docs/live) – Same for iOS and Android. |
| 180 | +- [OpenClaw](https://github.com/nichochar/openclaw) – Gateway and tool protocol (platform-agnostic). |
| 181 | +- Current iOS CI: `.github/workflows/ios-build.yml` – pattern for lint, build, artifact, and “zero warnings”. |
0 commit comments