Take the 2-minute tour ×
Android Enthusiasts Stack Exchange is a question and answer site for enthusiasts and power users of the Android operating system. It's 100% free, no registration required.

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?

share|improve this question
    
This question already has been asked, see: Can I change some Android settings from the command line? –  Izzy Feb 22 '13 at 16:57
1  
@Izzy I don't think that's fully a duplicate. –  Matthew Read Feb 22 '13 at 17:37
1  
@Izzy not related. The question you linked to has nothing to do with location services. –  lorddev Dec 11 '13 at 20:05
1  
@lorddev No, they are not explicitly mentioned. But you can use the same code to call the intent for location services. What confuses me a little is the phrasing of my comment, which suggests a "direct hit" (and here you're both correct: it's not exactly the same). Hard to say, half a year later, what I had in mind back then... –  Izzy Dec 11 '13 at 20:27

1 Answer 1

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 into settings.db (part of com.android.providers.settings)
  • put is to update key location_providers_allowed with value gps in table secure.

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.

                                                                    IMG: 4.2.1

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.

                                                                    IMG: 5.0

Is it also possible to change other system-related settings?

See :

But I already gave a big idea using settings put.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.