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?
Asked
Active
Viewed 330 times
0
-
Possible of duplicate http://stackoverflow.com/questions/10302894/ics-android-enable-gps-programmatically – Sanket Shah Aug 30 '13 at 04:25
1 Answers
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