Starting with some Android version (I think 2.3.x), you cannot turn on/off the GPS via the API, no matter what permissions the app has. In the past, it was possible by explo
This SO Question seems to be the closest to anything related on the topic.
There was a bug exploit up until version 2.2 which enabled changing the GPS setting. After 2.3, it seems as if it's currently impossible to do without user intervention.
Here are the answers/comments of several unsuccessful attempts: - How can I enable or disable the GPS programmatically on Android? - https://stackoverflow.com/a/10004614/238722
Apparently there is a way of doing it with BusyBox, but I can't find anything solid online. Source: https://stackoverflow.com/a/14850224/238722
UPDATE
The answer linked related to BusyBox contains this working sample project available for download.