The dashboard (Raspberry Pi 3.5" screen + web pages), the end-to-end encrypted sync mailbox (PHP + SQLite) and the Android companion app (Flutter), with docs, clean-install checks and screenshots made from demo data. Built mostly with an AI coding assistant; not yet reviewed line by line by a human (see README and SECURITY.md). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
76 lines
3 KiB
Markdown
76 lines
3 KiB
Markdown
# The phone app
|
|
|
|
Flutter, Android. It keeps its own copy of the data, works offline and syncs through your server
|
|
([server.md](server.md)) about every 5 minutes while open and about hourly in the background.
|
|
|
|
## Build
|
|
|
|
You need Flutter with Dart 3.12 or newer (the app is built with Flutter 3.44) and the Android SDK.
|
|
|
|
```bash
|
|
cd app
|
|
flutter pub get
|
|
flutter test
|
|
flutter build apk --release
|
|
```
|
|
|
|
Install `build/app/outputs/flutter-apk/app-release.apk` on the phone.
|
|
|
|
### Signing
|
|
|
|
A release build without a key is signed with the debug key. That APK installs, but your later builds can't
|
|
update it, and it can't update a properly signed install. Make a key once and keep it safe, outside the
|
|
repo:
|
|
|
|
```bash
|
|
keytool -genkey -v -keystore ~/keys/dashpi-upload.jks -keyalg RSA -keysize 4096 -validity 10000 -alias dashpi
|
|
```
|
|
|
|
`app/android/key.properties` (git ignores it):
|
|
|
|
```
|
|
storeFile=/home/you/keys/dashpi-upload.jks
|
|
storePassword=…
|
|
keyAlias=dashpi
|
|
keyPassword=…
|
|
```
|
|
|
|
### Your own defaults (optional)
|
|
|
|
These can be built in with `--dart-define` so the app starts with them; all of them can also be set in the app:
|
|
|
|
| Define | What | In the app |
|
|
|---|---|---|
|
|
| `DEV_SERVER` | The server the connect screen suggests, e.g. `https://sync.example.com` | Connect screen |
|
|
| `PI_URL` | The dashboard on your home network, e.g. `http://192.168.1.50:8080`, for "sync now" | Sync page ▸ Dashboard on the home network |
|
|
| `HOME_PLACES` | Weather places, home first: `Home, XX\|47.17\|24.06;Town, XX\|46.77\|23.60` | Weather ▸ Add a place |
|
|
|
|
## Connect
|
|
|
|
1. Set up sync on the dashboard first (Settings ▸ General ▸ Sync, [dashboard.md](dashboard.md)).
|
|
2. There: **Devices ▸ Add a device** → a QR code.
|
|
3. In the app: **Scan the code from the dashboard**, then type the passphrase (or use the recovery key).
|
|
Without a camera, type the server and token shown under the code.
|
|
|
|
The token and the data key are kept in Android's keystore-backed secure storage. The app's database is
|
|
excluded from Android backups; the dashboard keeps the data anyway.
|
|
|
|
**Sync now:** with the dashboard's address set (Sync page), the app asks the dashboard on the home network
|
|
to process new band data right away. The request is sealed with the data key. Away from home nothing happens.
|
|
|
|
**Gadgetbridge:** Sync page ▸ Band (Gadgetbridge): pick Gadgetbridge's database export (Gadgetbridge ▸ Settings ▸ Auto
|
|
export). The app relays new rows to the dashboard, which works out the sleep, heart and activity summaries.
|
|
|
|
## Updates over the air (optional)
|
|
|
|
The app can update itself from your sync server. `tool/publish.sh` builds the next build number, signs it
|
|
and uploads `app.json` + the APK to the server's `app/` folder over SSH. Phones then offer it on the Sync page.
|
|
|
|
```bash
|
|
cp tool/publish.env.example tool/publish.env # your server, SSH login, defines
|
|
# write a "## x.y.z — date" entry in CHANGELOG.md for the pubspec version
|
|
tool/publish.sh
|
|
```
|
|
|
|
The primary dashboard mirrors the newest build at `http://<dashboard>:8080/app` for a first install on the
|
|
home network.
|