Zafgo
On this page

BLOGTechnical

Real-time driver tracking in ride-hailing apps: how it works

How the moving car on the rider's map gets there: location updates, phone platform rules, battery and accuracy trade-offs, privacy and cost.

Short answer

Real-time tracking works by having the driver app read the phone's GPS, send the position to your server at a regular interval, and push it on to the rider's app and the operations console. The hard parts are not the map: they are keeping location running in the background within iOS and Android rules, saving battery and mobile data, smoothing noisy GPS points so the car does not jump, and protecting the location data you collect. Plan the update interval by trip state, ask for background location only for drivers, and budget for map and routing API calls, which grow with every active trip.

How tracking works, end to end

  1. The driver app reads the location from the phone's location services, which combine GPS, Wi-Fi and mobile network signals.
  2. It sends updates to the server with the position, time, speed, heading and accuracy, over a persistent connection or regular requests.
  3. The server stores the latest position for matching and keeps the trip's path for the fare, receipts and disputes.
  4. The server pushes the position on to the rider following the trip, to anyone the rider shared the trip with, and to the console map.
  5. The rider app animates the car smoothly between updates, so it moves along the road instead of jumping.

Update interval by trip state

A typical approach to update frequency
Driver stateWho needs the positionUpdate approach
OfflineNobodyNo tracking at all
Online, waiting for requestsThe matching engine and the consoleLess frequent updates, enough to keep positions fresh for matching
On the way to the pickupThe rider, waiting at the kerbFrequent updates; this is when riders watch the map most
On a tripThe rider, shared contacts, the console and the fareFrequent updates; keep the full path for distance-based fares

Sending less often while waiting saves battery and data for drivers who may be online for many hours. Many apps also send only when the driver has moved a minimum distance, so a parked car does not send the same point again and again.

iOS and Android background location rules

The driver app must keep sending its location while the driver uses navigation or the phone screen is off. Both platforms restrict this, and both app stores review it:

  • Android needs a foreground service with a visible notification while location runs in the background, and Google Play asks apps that use background location to declare it and explain why.
  • iOS needs the background location mode and a clear explanation in the permission prompt. Apple reviews whether the app really needs it.
  • Only the driver app should ask for background location. Rider apps normally need location only while open, to set the pickup.

Getting this wrong is a common reason for store rejection. Our guide to App Store and Google Play approval covers the declarations and disclosures in detail.

Accuracy, smoothing and battery

  • GPS is noisy. Near tall buildings and in tunnels a position can be wrong by a long way. Drop points with poor reported accuracy and ignore impossible jumps.
  • Snap to roads when it matters. Matching the path to the road network makes the car follow streets on the map and gives more accurate distances. It usually costs extra map API calls, so many apps snap only the finished trip path.
  • Animate between points. Moving the car marker smoothly between updates looks better than more frequent updates, and costs nothing.
  • Watch the battery. High-accuracy GPS, a bright screen and navigation drain phones fast. Drivers need car chargers, and the app should lower its accuracy and frequency when it can.

Privacy and safety

Location data is personal data. Collect drivers' location only while they are online, show riders the driver's position only during their own trip, and keep trip paths only as long as you need them for fares, disputes, safety reviews and the law. Tell drivers and riders this clearly in your privacy notice.

Tracking is also a safety feature. Live trip sharing lets a rider send a link to a friend, and an SOS alert can send the current position to your operations team. See safety tools for what Zafgo includes.

What tracking costs to run

Location updates themselves are cheap to send and store. The cost comes from map and routing services: showing maps in the apps, calculating arrival times, routes and road distances, and snapping paths to roads. Those are usually billed per request or per user, so they grow with every active trip. Calculate arrival times on the server and reuse them, rather than calling a routing API from every rider's phone.

Tracking in Zafgo

Zafgo's passenger app, driver app and operations console include live tracking from the request to the drop-off, trip sharing and SOS alerts, so you don't have to build this layer. The apps are published from your own store accounts under your brand. See the driver app and the passenger app.

Questions people ask

How does Uber show the driver moving on the map?

The driver app sends its GPS position to the server every few seconds during a trip. The server pushes each update to the rider's app, which moves the car marker smoothly between points along the road.

Does real-time tracking drain the driver's battery?

Yes, GPS and navigation use a lot of power. Good apps lower the update frequency while drivers wait for requests and send only when the car has moved. Most drivers keep their phone on a car charger.

Does the rider app need background location?

Usually not. The rider app needs location only while it is open, to set the pickup point. Only the driver app needs to track in the background, and both app stores review that permission.

Which map provider should I use for tracking?

Any major provider can display a moving marker. The difference is in pricing, routing quality in your country and terms of use, so compare costs at the number of trips you expect.

How long should I keep trip location data?

Only as long as you need it for fares, disputes, safety and legal duties in your country, and say so in your privacy notice. Check local data protection law before you set the period.

Sources

  1. Zafgo safety tools: trip sharing and SOS checked
  2. Taxi app App Store and Google Play approval guide checked
Book a demoSee pricing