Android Location Services – How Does It Know Where You Are?
Android knows where your device is through a number of techniques built into the operating system and three main technologies, which can work separately or together to determine your location.
Before I look at these technologies, there are two main reasons why it's useful for your device to know where it is and the first is immediately obvious when you are trying to find somewhere. I am the son of a Royal Air Force Navigator but I didn't inherit my father's sense of direction. My smartphone can not only tell me where I am but can also tell me how to get where I want to be. But in order to do this, it needs to know where I am.
Location services are useful when using a Google Internet Search; if I search for my bank, Google presents me with the closest three hits in its database and provides me with an estimate of how far they are from my present. This sort of information is especially relevant when I am in a city I don't know and I'm looking for a business.
Now let's take a look at the location technologies behind the magic and there are many sensors that can determine where it is.
The first technique is called Cell ID, which uses the modem to identify the mast that the device is connected to. In Google Maps, you can see the shaded area; your device assumes that you are somewhere in that area. Android does not take measurements from all of the cellular masts that it can see, only the mast that you are connected to at that time. It also uses network-provided information for the location of the mast and the broadcast power: if you are in an urban area, it may be more accurate since networks provide less powerful but more frequent cell sites. In a rural area, a single mast may cover a comparatively large area.
This method requires an active data connection and uses Google location service. It uses very little power but is the least accurate method of determining your location because cell sites may cover a very large area and sometimes, your device is not connected to the closest mast.
The second method uses your WiFi radio. This is similar to the Cell ID method but instead is based on what WiFi networks your device can see, not necessarily the WiFi you are connected to. This method relies on crowd-sourced data; in other words, it is reliant on the WiFi router knowing where it is. As with Cell ID, WiFi scanning uses the Google location service.
I travel on WiFi-equipped trains and I can see that the router was installed in Dortmund, Germany…
WiFi-location uses relatively little power and can be more accurate than a cell site location, because WiFi routers have a shorter range, but in rural areas there simply may not be any WiFi networks close enough to your device to be detected. For those tablets that only have a WiFi radio, this may be your only way of determining location.
Global Positioning System (GPS)
The third method involves a built-in global positioning system, originally just GPS (global positioning system) but more recently A-GPS (Assisted Global Positioning System) encompassing GLONASS (the Russian equivalent of GPS). A-GPS essentially bundles the cell ID information to help the system find the satellites quickly and more accurately. GPS based systems can also have their speed boosted by a barometer (this helps determine the approximate altitude).
GPS is the most accurate location service available for your device but also uses the most energy, as searching for the satellites uses a lot of energy. Fortunately, relatively few applications trigger the GPS radio unless you are using it and when they do, by default they show a location services symbol on your device's notification tray (typically flashing whilst searching and solid when it has acquired a fix on your location).
I've mentioned the Google location service above. This is Google's crowd-sourced database that your device taps into to figure out where it is. The database consists of the location of cell sites and WiFi routers across the globe. It's also the information service that provides the traffic data in Google Maps: that's right, when you use the Google location service, you are also giving something back!
Android Kit Kat provides three location service modes. The first is called High Accuracy; here you are permitting the device to use Cell ID, WiFi and GPS to determine your location. The second is called Battery Saving, which disables the GPS system and the last is called Device Only, which disables Cell ID and WiFi scanning (so doesn't use the Google location service) and is reliant on GPS services.
In my practical experience, I've not seen a measurable difference between High Accuracy and Battery Saving location services when it comes to battery management. Device Only mode, however, well the device usually doesn't know where it is unless I give it several minutes to acquire a GPS or GLONASS fix!