The Problem
A regional freight company with 60 drivers was tracking deliveries through a combination of driver phone calls, manual spreadsheet updates, and end-of-day paper manifests. Dispatchers had no real-time visibility into where trucks were or whether deliveries had been completed. Customer service calls asking for delivery ETAs consumed half a dispatcher's day.
They needed: real-time GPS tracking, digital proof-of-delivery (signature + photo), route optimization, and two-way communication between dispatch and drivers — all on Android, since that was the device fleet they already owned.
Why Native Android
We evaluated React Native vs. native Kotlin before committing.
The deciding factor was GPS behavior in the background. Android's background process handling is aggressive about killing non-foreground apps to preserve battery. A React Native app using a JavaScript-layer location library would require a headless task with careful wakelock management. In native Kotlin, this is handled reliably with a ForegroundService that Android treats as a first-class citizen and doesn't kill.
For a logistics app where location accuracy while driving is the core value proposition, we chose native Kotlin without hesitation.
Technical Architecture
Android app (Kotlin):
ForegroundServicefor continuous GPS location (updates every 30 seconds while moving, 5 minutes stationary)- Location sent via WebSocket to the Node.js backend for real-time dispatcher visibility
- Offline-first: location events queued to local Room database when connectivity drops, synced on reconnect
- Google Maps SDK for route display and navigation handoff
- CameraX API for proof-of-delivery photos (compressed before upload)
- Digital signature capture via custom Canvas touch view
Backend (Node.js + Express):
- WebSocket server (ws library) for bidirectional driver-dispatch communication
- REST API for manifest management, delivery status, and reporting
- PostgreSQL for all delivery and manifest data
- PostGIS extension for geospatial queries (e.g., "all trucks within 50 miles of Austin")
- Firebase Cloud Messaging for push notifications to driver devices
Dispatcher web dashboard:
- React SPA with a Google Maps embed showing live truck positions (updated via WebSocket)
- Delivery manifest management with drag-to-reorder route optimization
- Real-time chat per driver
- End-of-day reporting exports (PDF, CSV)
Results
Before:
- Dispatcher visibility into truck locations: zero (phone calls only)
- Delivery confirmation accuracy: ~70% (manual, often delayed)
- Proof of delivery: paper signature, filed manually
After:
- Real-time location visibility for all 60 trucks
- Delivery confirmation accuracy: 98% (digital POD, timestamped and geotagged)
- Customer ETA requests handled by automated SMS update instead of dispatcher calls
- Dispatcher time on ETA calls: reduced by 80%
"Our dispatchers now spend time on exceptions, not on 'where's my truck' calls. That's what we needed."
Deployment
APK distribution via Google Play's internal test track, then promoted to production. Device enrollment was handled by the company's IT contact — we documented the MDM enrollment process step by step. Driver onboarding: a 20-minute in-person session per depot, 3 depots over one week.
Lessons
The offline-first architecture was the correct architectural decision even though it added complexity. Several drivers routinely drove through areas with no cell coverage. Without the local queue and sync on reconnect, those deliveries would have created data gaps. With it, the data was seamless.
PostGIS was worth the setup time. The geospatial queries that support the "nearby trucks" feature and the zone-based alerting would have been significantly more complex without it. If you're building anything with location data at scale, reach for PostGIS early.