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
orgps,network
-- High accuracy modewifi,network
ornetwork
only -- Battery saving modegps
-- Device only
No comments:
Post a Comment