US trucking · Case study · 2 min read

Driver app with live GPS tracking

An iOS and Android app for truck drivers that reports where the truck is, including when the phone is in a pocket and the app is closed.

Type
Mobile app
Built with
React Native, native iOS and Android location code
Our part
The tracking in the app and the server side that receives it

The problem

Brokers and customers want to know where their freight is without calling anyone. For that to work, the position has to arrive on its own, all day, from a phone the driver is not looking at. Phones are built to do the opposite: iOS and Android both shut down apps that run in the background, to save battery.

Usually reporting is not good enough. If a dispatcher has to wonder whether a quiet truck is parked or the app has died, they are back on the phone.

What we built

The app is written in React Native, with native location code underneath that keeps running when the app is in the background or has been closed. Positions are sent as the truck moves, and at a regular interval when it is standing still.

Before tracking starts, the app walks the driver through every permission it needs, including the battery setting on Android that would otherwise let the system stop it. Tracking does not start until they are all in place.

A parked truck should still report. A watchdog restarts tracking if it ever stops.

The hard part

Finding out why trucks went quiet. We measured the gaps between positions across a month of live loads and split them by platform. iPhones were fine while the app was alive and then went silent for hours, usually with the truck parked overnight. Android phones stayed alive but reported too rarely.

The causes turned out to be specific. After a few minutes without movement the location service was switching itself off, so a parked truck produced nothing at all. And a single failed sign-in check could tell the app to stop tracking for good while everything else about it kept working, which left a truck on the map days behind its real position.

Two fixes came out of that. A watchdog in the app checks every 40 seconds that tracking is still running and restarts it if it is not. And the server treats any position older than an hour as a problem to act on, not a fact to display.

Where it is now

In daily use across the fleet on both platforms. We keep measuring the gaps from real loads, so each fix starts from numbers and not from a complaint.

Have something you need built?

hello@thinairstudios.dev