35 lines
1.5 KiB
Markdown
35 lines
1.5 KiB
Markdown
# Android App (Capacitor)
|
|
|
|
This folder contains the Android app build for the project. The app reuses the existing web UI (apps and builder screens) and wraps it with Capacitor for native Android deployment.
|
|
|
|
## Goals
|
|
- Reuse the existing web UI with minimal divergence.
|
|
- Provide a native Android APK for distribution.
|
|
- Sync apps between device and backend.
|
|
- Build via GitHub Actions; do not build locally.
|
|
|
|
## How it works
|
|
- **UI reuse:** `npm run prepare-ui` copies `../chat/public` into `www` and injects a bridge script so existing pages can talk to native APIs.
|
|
- **Native bridge:** Capacitor provides native access to preferences and HTTP requests.
|
|
- **Local storage:** Apps are saved using Capacitor Preferences plugin, isolated per user.
|
|
- **Syncing:** `syncApp` posts the locally saved app JSON to the backend.
|
|
|
|
## Setup
|
|
1. Install prerequisites (Node 18+, Android SDK).
|
|
2. From this folder: `npm install`.
|
|
3. Pull UI assets: `npm run prepare-ui`.
|
|
4. Add Android platform: `npx cap add android`.
|
|
5. Sync: `npx cap sync android`.
|
|
|
|
## Development
|
|
- `npm run build` prepares UI and syncs with Android.
|
|
- `npx cap open android` opens Android Studio for development.
|
|
|
|
## CI build
|
|
- GitHub Actions workflow: `.github/workflows/build-android-app.yml`.
|
|
- The action runs on `ubuntu-latest`, sets up Java/Android SDK, and builds the APK.
|
|
|
|
## Security notes
|
|
- API keys are stored in Capacitor Preferences (encrypted on Android).
|
|
- OpenCode execution is not supported on mobile (desktop app only).
|