Wednesday, May 25, 2016

How to detect GPS status through adb shell?


I need to detect GPS status through adb shell. I have tried dumpsys location command but the output of this command is not changed when the GPS is enabled/disabled.




Answer



You can use this command:


adb shell settings get secure location_providers_allowed

Possible outcomes:



  • returns nothing, implying the GPS is switched off.

  • gps,wifi,network or gps,network -- High accuracy mode

  • wifi,network or network only -- Battery saving mode

  • gps -- Device only



No comments:

Post a Comment

samsung galaxy s 2 - Cannot restore Kies backup after firmware upgrade

I backed up my Samsung Galaxy S2 on Kies before updating to Ice Cream Sandwich. After the upgrade I tried to restore, but the restore fails ...