3

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.

4
  • Did you try the solution here? If it works will post as an answer
    – beeshyams
    Commented Jul 25, 2017 at 11:40
  • Which Android version and device?
    – Firelord
    Commented Jul 25, 2017 at 11:46
  • See if adb shell settings get secure location_providers_allowed works for you.
    – Firelord
    Commented Jul 25, 2017 at 11:53
  • Thanks @Firelord, works like a charm. I'd like to mark your comment as the correct answer if you post it.
    – talha06
    Commented Jul 25, 2017 at 12:26

1 Answer 1

4

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .