On the Way
Driving proximity alerts for saved places on your phone and Android Auto car display.
On the Way
On the Way alerts you when you are driving within a few minutes of a place on one of your lists. You import a list of places (a CSV file at a link), turn on drive mode, and the app watches your location in the background. When a saved spot is within the time you chose (anywhere from 1 minute to 2 hours away), you get a heads-up alert with a Navigate button. On Android Auto the alert also appears on the car screen.
- App ID:
com.parkfour.ontheway(Android and iOS) - Version: 0.4.2
- Platforms: Android (phone and Android Auto). iOS phone support is written but CarPlay is not built yet.
Features
- Import lists from a link. Paste a link to a CSV file, or share a link into On the Way from another app (Android works out of the box; iOS needs the Share Extension set up, see below). Places are stored on the phone and duplicates are skipped. The app remembers each list and re-downloads it every time it starts, so places added to the file show up automatically. Import as many lists as you like, up to 5,000 spots in total; the Lists button at the top of the dashboard shows each list and lets you remove one.
- Per-spot toggles. Turn individual places on or off, or swipe a place away to delete it.
- Time-based alerts. Choose how far ahead you want to hear about a spot: 1, 2, 5, 10, 15, 20, 30 or 45 minutes, or 1, 1.5 or 2 hours. Alerts read like "Blue Bottle · about 12 min away".
- Navigate from the alert. On Android the button opens Google Maps turn-by-turn, and Maps offers "Add stop" if you are already navigating. On iOS it opens Google Maps if it's installed, otherwise Apple Maps.
- Android Auto
- A "Saved spots nearby" screen lists your closest spots next to a map. Tap one to navigate.
- Alerts show as heads-up notifications on the car display.
- Drive mode starts by itself when the phone connects to the car and stops when Android Auto disconnects.
- Permissions setup screen. Walks through each permission the app needs and explains why.
- Private by design. Your location never leaves the phone. The only network calls the app makes are downloading the lists you import, once at import and again each time the app starts.
How it works
Importing a list
ListImporter (lib/services/list_importer.dart) downloads the link and parses it as CSV. The first row is a header; column names are matched case-insensitively, and common spellings are accepted so exports from other tools import unchanged:
| Field | Required | Accepted headers |
|---|---|---|
| latitude | yes | lat, latitude, location/lat, location.lat |
| longitude | yes | lng, lon, long, longitude, location/lng, location.lng |
| name | no | name, title |
| address | no | address, street |
| id (de-dupe key) | no | id, placeId, place_id, key; without one, lat,lng is used |
Rows without valid coordinates are skipped. The list is named from the Content-Disposition filename, else from a URL ending in .csv, else the URL itself is shown. Every failure (a bad link, no network, a non-CSV response, missing coordinate columns) produces a readable error message instead of a crash.
Each successfully imported link is saved in the lists table with its title, and each spot records which list it came from (places.list_url). On every app start the dashboard re-downloads those lists and adds any new spots. All lists share a limit of 5,000 spots (PlaceDb.maxPlaces); new spots past it are left out and the app says how many. A new list with no room isn't saved. Removing a list in Your lists deletes its spots and stops its refresh. A refresh only adds: spots removed from the file stay in the app, and a spot deleted in the app comes back if it's still in the list (switch it off instead). A list that fails to refresh (offline, link gone) is skipped until the next start.
Time-based proximity
The app doesn't look up real driving times. It estimates them from straight-line distance, at an effective straight-line speed you pick on the dashboard: City (30 km/h), Standard (40 km/h, the default) or Highway (70 km/h). Standard is a typical 50–55 km/h road average, adjusted because roads don't run in straight lines, so 1 minute is about 670 m and 2 hours about 80 km.
The estimate works offline, costs nothing, and never lags behind a moving car. If it proves too rough, the upgrade path is a routing API such as Google Routes, which needs an API key and billing.
A second setting, Only spots within N km of you (100 km by default, up to 1,200 km), is measured from where you are at the moment, so it keeps up on a road trip without reopening the app. Spots farther away stay saved but don't alert, don't show on the car screen, and are hidden from the dashboard list unless you switch on Show all. It also caps the alert range: a 2-hour alert at Highway speed would be 140 km, but with the 100 km setting it stops at 100 km.
Each spot alerts once when you come within range. It can alert again only after you have been more than twice the range away. This stops GPS jitter at the edge of the range from firing repeat alerts.
The same logic exists twice, and the two copies must stay in sync:
lib/services/proximity_service.dart(Dart, used on iOS)android/app/src/main/kotlin/com/parkfour/ontheway/Proximity.kt(Kotlin, used on Android)
Why a location stream instead of geofences
The app follows your location continuously while drive mode is on, instead of registering OS geofences. There are three reasons:
- Android allows only 100 geofences per app and iOS only 20 regions. Saved lists are often bigger.
- Android can deliver geofence events minutes late.
- The alert range changes whenever you move the time slider, and geofences are fixed circles.
Drive mode on Android
Drive mode on Android is native Kotlin, not Dart. It has to start when the car connects, and at that moment the Flutter engine usually isn't running.
DriveServiceis a foreground service with location type. It reads your spots and the alert setting directly from the app's SQLite database (places.db) throughSpotStore, and posts alerts throughCarAlerts.- Auto-start: Android doesn't tell apps that aren't running when Android Auto connects. The app uses Bluetooth instead.
CarBluetoothReceiverwakes the app when the phone connects to a car-audio or hands-free Bluetooth device.- The service then uses the Car App Library's
CarConnectionAPI to confirm Android Auto actually connected. If it doesn't within 3 minutes, the service stops itself. - Opening the app on the car screen also starts drive mode.
- Android only allows this background start if the app is exempt from battery optimization. The permissions screen asks for that exemption.
- The service then uses the Car App Library's
- Stopping: drive mode started automatically stops when Android Auto disconnects. Drive mode you start yourself from the phone keeps running until you stop it, either on the dashboard or with the Stop button on the "On the Way is on" notification.
Android Auto
SpotsCarAppService is a Car App Library app in the points-of-interest (POI) category.
- The car screen shows your enabled spots sorted by distance, as many as the car allows, using a list-and-map layout drawn by Android Auto (
PlaceListMapTemplate). - Alerts use
CarAppExtenderso they appear on the car display. Tapping Navigate there sends the destination to the car's maps app with theACTION_NAVIGATEintent.
iOS
- On iOS, drive mode is a background location stream handled in Dart.
- Alerts use
flutter_local_notifications, marked time-sensitive so they break through Focus modes. - Alerts are also marked as allowed on CarPlay, but CarPlay only shows them once Apple grants the app a CarPlay entitlement (see Roadmap).
Project layout
lib/
main.dart App entry point
models/place.dart Place model
db/place_db.dart SQLite: places and settings tables
services/
list_importer.dart CSV list import from a URL
proximity_service.dart Drive mode toggle; iOS proximity logic
notification_service.dart iOS alerts
navigation_launcher.dart Open Google Maps / Apple Maps
permission_service.dart Permission checklist
ui/
dashboard_screen.dart Home: drive mode, alert time, spot list
import_sheet.dart Import-a-list bottom sheet
permissions_screen.dart Permission setup flow
android/app/src/main/kotlin/com/parkfour/ontheway/
DriveService.kt Native drive mode (foreground service)
CarBluetoothReceiver.kt Auto-start on car Bluetooth connect
SpotsCarAppService.kt Android Auto car screen
CarAlerts.kt Phone and car heads-up alerts
Proximity.kt Kotlin twin of the proximity logic
SpotStore.kt Reads places.db natively
MainActivity.kt Drive-mode channel for Flutter
test/logic_test.dart Dart unit tests
android/app/src/test/… Kotlin unit tests
Getting started
Requirements:
- Flutter 3.47 or newer (stable channel)
- Android SDK Platform 37 and the Android SDK command-line tools
- Xcode, for iOS builds
flutter pub get
flutter run # on a connected device or emulator
flutter analyze && flutter test # Dart checks and tests
(cd android && ./gradlew :app:testDebugUnitTest) # Kotlin tests
To test Android Auto without a car, use Google's Desktop Head Unit. In the Android Auto app on the phone, open the developer settings and enable Unknown sources, because Android Auto hides apps that weren't installed from Play.
Releasing to Google Play
Release builds are signed with the upload key named in android/key.properties:
storePassword=…
keyPassword=…
keyAlias=upload
storeFile=../ontheway-upload.jks
key.properties and *.jks files are git-ignored. Back both files up somewhere safe. If they're lost, Play support can reset the upload key, which takes a few days. Without key.properties, release builds come out unsigned rather than debug-signed.
- Bump
version:inpubspec.yaml. The number after+is the Android version code, and it must increase with every upload. - Build the bundle:
flutter build appbundle --release - Upload
build/app/outputs/bundle/release/app-release.aab.
Google Play will ask for:
- A background-location declaration, with a short video showing why the app needs location all the time.
- A declaration for the location foreground service.
- Opt-in to Android Auto and its driver-safety review.
- A privacy policy URL.
iOS setup (still to do in Xcode)
- Share Extension: add a Share Extension target in Xcode and follow the
receive_sharing_intentsetup. Both targets need a shared App Group, andCUSTOM_GROUP_IDmust be set in Build Settings for both. TheInfo.plistentries are already in place. - Time-sensitive notifications: the entitlement is set in
ios/Runner/Runner.entitlements. Enable the matching capability for the app ID in your Apple developer account.
Known limitations
- Drive times are straight-line estimates, not routed times.
- Android auto-start depends on the car reporting itself over Bluetooth as a car-audio or hands-free device. Cars that report a different device type need the app opened on the car screen instead.
- On iOS, drive mode stops if the app is terminated. Relaunching it automatically would need significant-change location monitoring.
- The car-screen list is sorted by your location when the screen opens or you tap refresh. It doesn't re-sort as you drive.
Roadmap
- CarPlay: apply for Apple's CarPlay entitlement ("Driving Task" category), then build the car scene.
- Optional routed drive times.
- A "choose your car" setting for Bluetooth auto-start.
Knowledge graph
A graphify graph of the codebase can be generated into graphify-out/, which is git-ignored. Run /graphify . in Claude Code to rebuild it. .graphifyignore excludes the template icons.