Turn on GPS inside the code [duplicate]
Possible Duplicate:
Enable GPS program开发者_如何学Catically like Tasker
I would like to know how to turn on the GPS inside the code ? someone says you cannot and other says you can, I get confused Pleas help me,
Turning the GPS on requires user interaction as a security measure. If any application were able to turn the GPS on without the user knowing, that would be a very big privacy concern.
You can launch an Intent that takes the user to the GPS screen to turn it on / off.
startActivity(new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS));
精彩评论