【问题标题】:How to enable/disable GPS location services on Android 9 via ADB commands (not rooted device)如何通过 ADB 命令在 Android 9 上启用/禁用 GPS 定位服务(非 root 设备)
【发布时间】:2020-06-18 21:35:54
【问题描述】:

我正在为 Android 进行自动化操作,对于一些测试,我需要从代码中禁用/启用位置服务。 我试过这样的命令:

adb shell settings put secure location_providers_allowed -gps
adb shell settings put secure location_mode 0

但在 Android 7...9 上似乎没有任何工作。

有没有办法在一个命令中做到这一点?

谢谢

【问题讨论】:

    标签: android automation gps adb adb-shell


    【解决方案1】:

    启用: adb shell settings put secure location_mode 3

    禁用: adb shell 设置 put secure location_mode 0

    【讨论】:

      猜你喜欢
      • 2022-07-15
      • 1970-01-01
      • 1970-01-01
      • 2016-07-07
      • 2018-06-22
      • 1970-01-01
      • 2023-04-06
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多