0

For an Android device (4.0 or above) can GPS be turned off/on using java code instead of the user having to use Settings?

Nate
  • 31,017
  • 13
  • 83
  • 207

1 Answers1

1

After Android 2.3 it is no longer possible. Only apps signed with manufacturer platform certificate can use that permission.

The correct thing is to send the user to the location settings page, and let him enable GPS if he wish. e.g.,

Intent i = new
 Intent(android.provider.Settings.ACTION_LOCATION_SOURCE_SETTINGS);
startActivity(i);
prc
  • 860
  • 7
  • 16