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.

  • Did you try the solution here? If it works will post as an answer
    – beeshyams
    Jul 25 '17 at 11:40
  • Which Android version and device?
    – Firelord
    Jul 25 '17 at 11:46
  • See if adb shell settings get secure location_providers_allowed works for you.
    – Firelord
    Jul 25 '17 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
    Jul 25 '17 at 12:26

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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