Activate the smartphone’s GPS

Asked

Viewed 614 times

1

I’m developing an app that uses geolocation functions. The same is already getting the smartphone locations, and I can check whether the GPS connection or not. Until then quiet, what I’m not getting is that if the GPS is 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 in GPS and do not let the same use the app until it is turned on.

1 answer

4


Currently unable to enable/disable GPS directly from the application, however, you can yes take the user to the device setting that does this.

To this end, after making this check the GPS and find that it is off, the user can tap a button that will have this simple action to open the Activity configuration:

startActivity(new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS));

Now, make sure the app is not used until the GPS be ready, you already have the solution, since you make the availability check of it, sure?

  • Thanks @Paulo, it worked yes, exactly what I wanted, now just make a window with one to go to startActivity.

  • 2

    Great! Consider marking this answer as accepted if you have answered your question. It will help others with the same question.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.