I remember the “good ol’ days” of location-based programming where there was a simple API call that allowed an application to enable or disable a mobile device’s GPS service. Today, user privacy and security concerns make that sort’a thing no longer possible.

In today’s world, a phone’s user generally has ultimate control of what features are and are not enabled on their phone. Although I agree this behavior is best for users, it definitely creates headaches for developers.

The one thing we know we can’t do as developers, is display a message that simply says “Hey! Go turn on your GPS”. Seeing a message like that would cause most users to uninstall our app and look for an app that’s easier to use.

The good news is that as developers we can send the user directly to the location settings screen right from within our app with a simple Intent.

The exact format of the screen the user sees will vary based on their Android version and device model, but the above code will always take them to the appropriate settings screen. On my Samsung device, the ACTION_LOCATION_SOURCE_SETTINGS screen looks like the following…

In general what I’ll do is use the LocationManager class to check for the availability of the required location services. If the services aren’t enabled, I’ll show an AlertDialog informing the user of what they need to do and then show the settings screen in the dialog’s click handler. Here’s that code…

I was an avid blogger for many years when I was consulting and working as a trainer. As my work moved me away from those things, I stopped blogging and haven’t done so for several years.

Well … I’m back to consulting and working as a trainer and am feeling the itch to start blogging again …so that’s what I’ll be doing. 🙂

Most of what I blog will be technical software developer stuff (focused primarily on Android with some iOS on the mobile side / .NET on the server side). I’ll also being doing some fun stuff from life (being in Celebration, FL – 3 miles from Disney World – offers lots of opportunity for that). There’ll also be some spiritual stuff now-and-then as well.