I see this answer from 2013, but now there are options for High Accuracy, Battery Saving, and Device Only. Also, there was no command for disabling location.
1 Answer
You may check-out my updated answer dealing with the question in entirety, or consider the following info:
- High accuracy:
gps,wifi,network
orgps,network
(if you don't want Wi-Fi enabled) - Battery saving:
wifi,network
ornetwork
only - Device only:
gps
E.g:
adb shell settings put secure location_providers_allowed gps,wifi,network
To disable Location mode
adb shell settings put secure location_providers_allowed ' '
-
1This used to work on Android 5, but it doesn't anymore on Android 6. With or without root the setting does not change and stays the same as is configured on the system. It probably has something to do with
location_providers_allowed
being deprecated (developer.android.com/reference/android/provider/…).– gw0Commented Nov 4, 2015 at 7:43 -
@gw0 My phone has not received Android M update yet, so I am afraid I can't offer any help at the moment.– Firelord ♦Commented Nov 4, 2015 at 11:24
gps
andnetwork
out of the command. As for the various location modes, I would imaginegps
would representDevice Only
,network
would beBattery Saving
andgps
andnetwork
would beHigh Accuracy
.gps
andwifi
but withoutnetwork
?gps,wifi
-- it will simply activate "device only", the reason is mentioned in my original answer. Google's location service primarily needsnetwork
as a parameter to activate, so if it is not passed then "high accuracy" and "battery saving" would be out of the question. // And passing onlywifi
would not activate any option on its own.