Is Google Fused Location Api Trustworthy?

Hüseyin Bülbül
Volt Lines
Published in
4 min readAug 26, 2019

Almost everyone uses Google Fused Location Api to collect location in Android. What if I told you, you cannot trust it in every situation.

In Volt Lines we are helping other businesses move their employees in a cheaper, faster, safer and a more trackable way. With our business model, we are kind of Netflix of employee transportation. So we are a company that heavily works on location. Location data is one of the cores of our business and our location data must be accurate and reliable. And we tried to follow every rule on Google Api’s documentations. Because we do not want to exploit resources of the mobile phones of our drivers. And as our research shows, Google have some location and battery optimizations with this Fuse Location Api. But there are still complaints from random drivers and passengers that location of the driver was not updating in the app.

At the end of the day I could not find anything wrong with the code and we never lived this problem while testing. And since it was not happening over lots of drivers this problem did not get much attention. But with increase of our driver count this randomness became more noticeable. We started to see several more drivers having this problem on a daily basis. Weird thing though, there is no apparent reason for it to happen. When I looked at two weeks of history of one driver, same driver, same phone, same app version works for one week then with no reason does not send location for one week. Then again without us doing anything it becomes normal and starts to work at some random day. And all of the drivers who has this problem was like this. Without showing any pattern or reason drivers phones stopping sending location for several days. Then start sending location again without no pattern or reason. In one version of our app I tried to send metrics for a lot of lines in the code so I can see if there is a pattern. But no no, there was still nothing. They app just didn’t feel like sending locations some of those days.

One day I decided to go to field work and selected a driver whose phone did not send any location for couple of days. I opened our app on the drivers phone and it literally did not show any location. It looked like the location callback never get called. I remembered the old Nokia days, and thought maybe it will send location after several minutes, with no luck. It didn’t seem like it is going to send any location. Then I tried opening Google Maps to see what it is doing. It did not showed any location either for like 20–30 seconds. Then the blue dot appeared. I opened Volt Lines Driver app and it started to show location too. Then I tried couple of things that I think may cause location problem including restarting phone while GPS closed. But the app still sent location immediately. So my conclusion was Google Maps did something that made Fuse Location Api get to work. And there was two options in my mind. a) First one is Google Maps triggered something in Fuse Location Api that I do not know. Secondly google maps might be using Android’s own location manager and that somehow triggered Fuse Location Api. The second one was the thing I could check. So I prepared a version which was only using Android location manager not Google Fuse Location Api. And it worked. We did not see any drivers who wasn’t sending location to our servers.

At left locations from fuse location api, at right locations from android location manager api

But there was an expected result of this. Fuse Location Api fixes location jumps according to the roads. But Android Location Manager does not fix this. You can take a look at above image to see what I mean. For example, we are operating in Istanbul and we have three bridges over Bosporus here. And while using Android Location Manager, almost all of the routes passing the bridges take a quick dive in bosporus and get back to bridge again. As far as I know buses cannot swim, right? :) Now we are planning to fix these jumps on our own since we cannot actually trust Google Fuse Location Api. And while researching this topic online, I found out Uber’s team is not even trusting Android Location Manager and they started to get satellite data and use their own calculations for location. Knowing that Uber is several years ahead of us we might end up in same situation in the future. If you are still here and did not left at half thank you, you are great.

And by the way, if you want to work on this kind of problems in a fast paced start-up in one of oldest and beautiful cities in the world, check out our career page.

--

--