Android Location APIs

The problem with working with user locations on the Android platform is complexity. Android's location APIs are extremely complicated, and ever changing.

I was recently alerted to an issue with some of the location functionality within the Pub Reviews Android App. Having had a quick look in the developer documentation it quickly became apparent that the location services APIs had undergone significant changes and that this was going to be a tedious fix.

The problem is that when working with locations you need to make sure that:

  • The user has Google Play Services
  • The user has given you the appropriate permissions (on Android 6.0)
  • The user has the appropriate settings turned on to allow you to complete your LocationRequest

Not only do you need to check for the above, but if any of the above are not true then you need to provide a mechanism to allow the user to correct the issues.

Then you need to be able to test all of these things which to do so efficiently essentially requires that you have a number of devices with multiple different versions of Android, some of which do not have Google Play Services installed.

When combined with a complex user interface with a significant number of conditional display elements, and the intricacies of Android's in built memory management models (for orientation changes etc) then you have an extremely complex problem to overcome.

Thomas Clowes

Thomas Clowes

I am a 31 year old software engineer from the United Kingdom. During the day I build multi platform applications. In my spare time I eat food and run marathons. Sometimes I write angry tweets.