Cycle Star Android
The recording half of Cycle Star: press START, ride, and it works out what you saved.








Screenshots are from an emulator running the debug simulator, with an invented home and no map.
What it does
- Has one large START and STOP button. State is shown in plain words: Ready, Riding, Parked at event, Riding home.
- Follows the ride with GPS from a foreground service, so it keeps going with the screen off.
- Counts a stop only after you stay put for a set dwell time (3 minutes by default). A traffic light does not count.
- Finishes the trip by itself when you return home after at least one stop, then shows a summary: GPS distance, an optional e-bike odometer reading, the fuel price and one saved-dollars figure. Confirming it sets off a burst of coins.
- Fetches a live fuel price for the first stop, or uses a manual one. The hourly parking rate, the consumption of the car not driven, the home radius and the savings goal can all be changed in settings.
- Works offline: trips wait in the local database and upload later.
Under the hood
- Kotlin, Jetpack Compose and Material 3, minimum Android 8. Room for storage, WorkManager for sync, OkHttp for the API and the fused location provider for fixes.
- The trip logic is a pure Kotlin state machine with no Android imports: idle, armed, riding, parked, finished. Time comes only from the fixes it is given, so it is deterministic and the unit tests can replay recorded traces.
- GPS noise handling is explicit. Fixes with poor accuracy or an impossible implied speed are dropped, small movements while still count as jitter, and distance is summed along longer chords rather than every noisy step. That last rule was added after a simulated walk over-measured distance by about 20 per cent; the simulated routes now measure within a few per cent.
- A debug-only simulator replays synthetic cycling and walking trips, including a red light that must not count as a stop, through the same code path as real GPS.
- Each accepted fix is written to the database as it arrives, so a process killed mid-ride is restored from it.
- Sign-in uses Credential Manager with Google. The Worker exchanges the ID token for a long-lived signed app token, which lets the background sync run without any sign-in screen. If the edge credential or sign-in is missing, the app still works locally and Settings says what is not configured.