Is it possible to enable Location Services(GPS or Google NetworkLocation) via ADB or Terminal Emulator? I'm on a rooted Phone.
Extra Points: Is it also possible to change other system-related settings?
Answer
Is it possible to enable Location Services(GPS or Google NetworkLocation) via ADB or Terminal Emulator?
The command is:
adb shell settings put secure location_providers_allowed gps
where,
settings
would makes changes intosettings.db
(part ofcom.android.providers.settings
)put
is to update keylocation_providers_allowed
with valuegps
in tablesecure
.
The aforesaid command wouldn't enable Google's Location Service. In order to enable it as well, issue the command:
adb shell settings put secure location_providers_allowed gps,network
You would be shown a popup to agree for Location Services. In my Android 4.2.1, I have to agree through GUI or input keyevent
every time I enable the service from scratch.
However, in my Android 5.0 I can save the settings in the dialog and the command execution makes the things done perfectly from the next time.
Some devices like Lollipop ones have three Locations modes, and the relevant values to be passed in the aforesaid command would be:
- High accuracy:
gps,wifi,network
orgps,network
(if you don't want Wi-Fi enabled) - Battery saving:
wifi,network
ornetwork
only - Device only:
gps
To disable Location mode
adb shell settings put secure location_providers_allowed ' '
Is it also possible to change other system-related settings?
See :
But I already gave a big idea using settings put
.
No comments:
Post a Comment