# Battery Efficient Real-Time GPS Tracking

One question we frequently get asked is “How real time is your tracking experience?” When we respond saying it’s near real time (~4 second latency) the follow up is “You must be collecting GPS locations very frequently, what’s the impact on battery life?” The fact is we only consume ~5% of battery per hour of tracking. So your fully charged phone can last full day of tracking without breaking a sweat. This blog is a deep dive on how we achieved close to real time tracking with minimal battery usage — two things that are perpetually in tension with each other in the smartphone tracking world.

Our solution is based on two discoveries:

1. Battery cost of GPS data transmission is ~5X to ~10X of collection. In short, using radio and cellular network on the phone is way more battery intensive than using the GPS sensor. We established this by performing wide array of experiments on variety of devices and Operating Systems under different network conditions, geographies, etc. HyperTrack is used by thousands of drivers in over thirty countries.
2. Active tracking sessions are sparse. In a typical tracking session, user tracking the driver actually looks at the tracking screen less than 20% of the time. This intuitively makes sense as well, if I am tracking a friend on an hour long journey I would typically pull out the phone 3–4 times for couple of minutes each. That much information is enough for me to know his whereabouts. Our consumer tracking data also confirms this behavior.

Discovery #2 tells us that real time transmission (active-mode) of GPS data is required only during those short periods when someone is actively tracking the driver. In the remaining time, we need to collect just enough GPS data to accurately meter the traveled distance and draw the route taken (passive-mode). These discoveries lead us to the following solution.

### Variable Frequency model

Say hello to the Variable Frequency (VF) model of GPS tracking.

It simply means that we do not collect and transmit GPS data at a single static frequency. Instead, we interpret the context and push corresponding commands to our SDK to collect and transmit GPS data at different frequencies at different points in time. We started with a very simple model. When a driver is being actively tracked we collect GPS data every few meters and transmit it every other second. When active tracking stops we change GPS collection to let’s say every 50 meters and transmit the batch of data every other minute. This change in transmission frequency from every other second to every other minute has tremendous positive impact on battery life. The benefit is amplified by the fact that we naturally operate in passive-mode for most part of the tracking session.

By decoupling collection and transmission frequency we gain more fine grained control over how our SDK uses smartphone resources (battery, network, etc). And by making both these frequencies dynamic we harness that control to provide battery optimized real time tracking experience to our customers.

### Context Driven VF model

Now we are past this initial implementation of active/passive mode and use more parameters to determine context and select the best frequency values. E.g. we use current battery percentage, whether the phone is on charging etc. We have a rule engine which continuously evaluates these parameters and selects the best possible frequency values at that instant and communicates these down to the SDK. Now our goal is to evolve this rule engine and make it much more context aware. It should know who is using the GPS stream, what are they up to on that trip and what latency do users expect when tracking the trip. We are building towards that level of context awareness in our Variable Frequency Model.

To come up with VF Model solution was a journey filled with insights, experiments and data analysis. Switch to MQTT helped us greatly in implementing this solution. Sign up, give it a shot, and let us know what you think of our tracking experience!

Have questions? Suggestions? Join the discussion on slack.

Like what we are doing? Sign up to use HyperTrack and build location tracking features!

Like what you read? Give Amit Rathi a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.