Plan configurable battery settings for the Android client
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Mdocs/android.md
@@ -82,7 +82,7 @@ A Custom Tab instead of a WebView for this part:
| Web: `#device` mode | the map page with the device endpoints, like guest mode |
| Web: `#pair` page | confirm step and redirect to `opentracker://` |
Later: per-device settings that the server sends back in the upload response, for example the sampling profile.
Later: per-device tracking settings, see [Configurable battery settings](#configurable-battery-settings-later).
## Battery
@@ -145,6 +145,25 @@ On Android 12 and newer, `LocationRequest.Builder.setMaxUpdateDelayMillis` lets
- driving costs about 3 % to 5 % per hour.
- Real traces may show that the sampling numbers need tuning. They are constants in one file for that reason.
### Configurable battery settings (later)
The constants above become per-device settings. They are edited in the web UI, so the app needs no settings screens.
- **Presets:** Battery saver, Balanced (the default) and Precise. Each fills in the table above.
- **Advanced values:**
- Walk and Vehicle intervals,
- the accuracy limit,
- the stationary heartbeat,
- the upload delay,
- the low-battery threshold.
Changing one turns the preset into "Custom".
- **Where:** Settings → Devices, a "Tracking" section per device. This also works from a desktop, and each device can have its own profile.
- **Storage:** a JSON `tracking` column on `devices`, with a version number. The server checks each value against a minimum and maximum, for example an interval between 1 s and 1 h.
- **Delivery:** the upload response and `GET /api/device` carry the config. The app applies it when the version changes. A stationary phone uploads every 15 minutes, so a change arrives within that time without a push service.
- **In the app:** the top bar and the notification show the active profile, for example "Balanced · stationary". There is nothing to change there.
- **Code:** `SamplingPolicy` takes a `Profile` data class instead of constants, and its JVM tests run once per preset. The `api` crate gets a `TrackingConfig` type, and `Uploaded` gets an optional `config` field.
## Permissions
| Permission | Why |