I\'m on Android 2.3.7 and I\'m trying to write a BroadcastReceiver that will get called when the user turns GPS on/off (ie: by tapping on the \"use GPS satellites\" in the optio
Starting from API 19 you can listen for the intent action LocationManager.MODE_CHANGED_ACTION.
You can also get the current location mode as follows:
try
{
int locationMode = android.provider.Settings.Secure.getInt(context.getContentResolver(), android.provider.Settings.Secure.LOCATION_MODE);
} catch (android.provider.Settings.SettingNotFoundException e)
{
e.printStackTrace();
}
The value returned should be one of these:
android.provider.Settings.Secure.LOCATION_MODE_BATTERY_SAVING
android.provider.Settings.Secure.LOCATION_MODE_HIGH_ACCURACY
android.provider.Settings.Secure.LOCATION_MODE_OFF
android.provider.Settings.Secure.LOCATION_MODE_SENSORS_ONLY