I'm currently writing an app in Android that works with the GPS, at the moment I'm able to work out whether the GPS is enabled, my problem is that I want to enable the GPS on app startup if it is disabled, how can I do this programmaticaly?
+14
A:
You can't, starting with Android 1.5. The most you can do is pop open the activity to allow the user to toggle it on/off. Use the action held in android.provider.Settings.ACTION_LOCATION_SOURCE_SETTINGS
to craft an Intent to open this activity.
CommonsWare
2009-06-27 00:33:48
Why is this disabled? Why not allow developers to toggle this? the Power Control widget can, so we should be able to as well. Dont you think?
Adam Lerman
2010-04-27 12:26:59
It is disabled for privacy reasons. If the user wants GPS off, the user should have GPS off, period.
CommonsWare
2010-04-27 13:13:39
+4
A:
if(!LocationManager.isProviderEnabled(android.location.LocationManager.GPS_PROVIDER )) {
Intent myIntent = new Intent( Settings.ACTION_SECURITY_SETTINGS ); startActivity(myIntent);
}
TS.xy
2010-07-23 02:22:54
+1
A:
is it possible to hack/root the phone in order to give this access right and turn on GPS programaticaly ? I also have same problem. Thanks, cheers!
Radus
2010-08-27 15:30:24