Enable smartphone GPS

1

I'm developing an app that uses geolocation functions. The same is already taking the locations of the smartphone, and I can check if the connection of the GPS or not. So far, what I'm not getting is that if the GPS is turned off, ask the user to turn it on, taking it directly to the GPS settings screen, or just with a click of a turn on the GPS and do not let the same use the app until it is connected.

    
asked by anonymous 08.04.2015 / 13:59

1 answer

4

You can not currently enable / disable GPS directly from the application, however, you can instead take the user to the device configuration that does this.

To do this, after doing this check GPS and find that it is off, the user can touch a button that will have this simple action to open the%

startActivity(new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS));

Now, make sure that the application is not used until GPS is ready, you already have the solution yourself,     

08.04.2015 / 14:25