How to turn on/off (enable/disable) GPS in Android

If you want to develop an Android app to turn on/off GPS you can use the following code snippets.

Source:
http://stackoverflow.com/questions/15426144/turning-on-and-off-gps-programmatically-in-android-4-0-and-above