GMS Location Services & Tracking

Darryn Campbell -
7 MIN READ
1008

This is the fifth in a series of blog posts looking at the considerations around adopting a GMS deployment in the enterprise.  Each post features a summary along with recommendations. For other posts in this series please see the links below:

 

One significant advantage of GMS devices over non-GMS devices is the availability of Google’s location services.  For users, location services provide enhanced position information and are designed with economical battery usage in mind.  For developers, location services allow them to easily access the most accurate location available for the device with minimal effort and efficient battery usage.

Summary

I did write a separate post where I go into detail on what location services are, the exposed APIs and how they relate to other location technologies available on your Android device, I suggest you check out that post before this one.

Location services are a collection of APIs and capabilities available on GMS devices to provide device location based on a number of possible technologies including GPS, cellular tower triangulation, Wi-Fi scanning, Bluetooth beacon scanning and accelerometers to assist with dead reckoning.  As well as providing raw location, the services provide higher level APIs such as geofencing to determine of a user has entered or left an area and more abstract concepts like user activity or location context (i.e. Geocoding or places of interest near the user)

 

Location Services & Settings

GMS devices require the user to agree to use “Google’s location service” which is the technology underpinning the “fused provider” and “location services”.  There is no check box in the Settings UI, the agreement must happen either:

  1. As part of the set-up wizard (image 1)
  2. When the location setting is turned on in the Settings UI (if it was declined during the SUW) (image 2).
  3. The Location Services SettingsClient API allows applications to prompt the user to agree to location services.  Image 3 shows the dialog given after a request for high accuracy and BLE, note the 3rd line item agreeing to the terms of the service.  This API replaces the previous SettingsAPI however the logic remains the same.

 

Image 1: Set-up wizard Image 2: Location setting Image 3: SettingsClient API or SettingsAPI
1.png 2.png 3.png
Sign up as part of the set-up wizard Sign up when enabling location Sign up after being prompted by the SettingsApi or SettingsClient

 

The set-up wizard’s “Improve location accuracy” option will enable Wi-FI scanning and Bluetooth scanning.

 

Wi-Fi scanning:

This setting allows your device to take advantage of the crowd-sourced AP location available as part of Google’s location service even when your device’s main Wi-Fi is turned off.  If this setting is turned off and the device Wi-Fi is also turned off then no Wi-Fi based location will be available (the device will still have access to cellular, BLE and GPS location, depending on settings and hardware).

 

This option moved between Lollipop and Marshmallow, previously under Wi-Fi -->Advanced it is now under Location --> Scanning (or just search settings for ‘Scanning’).

 

If the location mode is set to either ‘high accuracy’ or ‘battery saving’ and Wi-Fi is turned on (regardless of the Wi-Fi scanning option) then the device will use nearby Wi-Fi access points and query its location using device location services.

 

Bluetooth scanning:

This setting is only available on Marshmallow devices or higher and is designed to allow Android to take advantage of BLE beacons to improve the location accuracy of the fused provider (and anything that depends on the fused provider such as Geofencing).  This does not impact an application’s ability to scan for BLE devices using the BluetoothLeScanner API or use of the Awareness API

4.png

 

Disabling location settings

As stated in the set-up wizard, using location services requires anonymous location data to be sent to Google.  You may wish to disable location services on your device for privacy reasons or potentially to extend the battery life of your device, though the benefits to battery life are hard to quantify as it depends on what other applications on the device are using location.

 

Once you enable location services via one of the three techniques described above, there are a couple of ways to turn it off again.

 

5.png

Google’s UI, pictured, suggests turning the service off by either turning off the main location on your device (i.e. Settings --> Location --> On / Off) or by selecting device only mode (Settings --> Location --> Mode).  Because devices without a GPS chip (e.g. TC51 or TC20) do not offer you the option to modify the location mode the only way to disable it on those devices is by turning location off.  Remember that location can be modified by the user if they have access to the Settings UI or the notification quicksettings bar (two finger pulldown from the top of the screen) so ensure these are disabled if you do not want the device user modifying your location setting.

 

At the time of writing there is no specific MX capability to turn location off, the closest available feature is the Wireless Manager’s GPS Location Mode.  Location can be turned off either manually or via your EMM, if supported.

 

Location permissions & the Play Store

Applications can specify whether certain hardware features are required or optional, most pertinent here is the GPS feature:

 

<uses-feature android:name="android.hardware.location.gps" android:required="true"/>

 

Not all Zebra technologies devices have GPS, specifically those targeted at indoor verticals (e.g. healthcare or warehouse) will typically lack GPS capabilities for obvious reasons.

 

Specifying the GPS feature as required will prevent the application from being installed from the Play Store on devices which lack a GPS chip, you can either specify android:required=”false” or omit the <uses-feature/> tag entirely to allow the application to be installed  on such devices.  This only affects installation from the Play Store and you can still side load applications regardless of their hardware requirements (however applications may be unstable if they assume the presence of non-existent hardware).

 

Note that this is separate from the <uses-permission/> tags and the presence or absence of the following will have no effect on whether the application can be installed from the Play Store:

 

<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />

 

Location History

If you sign into a Google account on the device then you also have the option for Google to maintain a location history for you which will be associated with your account.  To avoid this either:

  • Do not sign into a Google account on the device (this does not affect managed Play accounts)
  • Opt out of location history on the device via Settings --> Location --> Google Location History --> On / Off.
  • Opt out of location history from your Google account, accessible via the internet.

 

 

Find my device

Android’s find my device tool, https://www.google.com/android/find, can act as a simple to use and readily available tool for finding lost devices or occasionally determining the position of a small set of devices.  The tool is consumer focused and is not designed to cater for a large number of location use cases but may prove useful for a minority of customers, especially those who do not use an EMM.

Two pre-requisites are required:

  • A Google account must be present on the device, the same account used to sign into the ‘find my device portal’ with location history enabled.  Google refers to ‘find my device’ in this context as part of the “device protection features”.
  • Location services must be enabled on the device

  The more information you allow the device to gather, the more useful the tool is

6.png

 

Recommendations

The additional location APIs offered on GMS devices provide a very simple and easy way for developers to obtain a device’s location but they require sharing anonymous location data with Google and are by far more accurate and useful outdoors.

 

Consider carefully your location use cases before assuming that the Google APIs meet your needs, for transport and logistics you can reliably determine a device’s location as well as whether the device is in a moving vehicle or on foot; for indoor retail or warehouse applications where AP and GPS location coverage is sparse then you are unlikely to be able to reliably determine your location with any precision.  Zebra has a whole division dedicated to helping your organization precisely locate assets, particularly indoors or where increased precision is required.

 

The other GMS location features mentioned here such as location history and ‘find my device’ are heavily geared towards consumer use cases.  The majority of enterprise customers will want to disable location history, by not opting into it or by turning it off as explained in Google’s official documentation on the subject

profile

Darryn Campbell

Please Register or Login to post a reply

Replies