无法使用“adb shell settings put”设置 location_providers_allowed 的值

Mar*_*elo 3 android adb

我正在尝试使用以下命令打开位置:

adb shell settings put secure location_providers_allowed gps,wifi,network
adb reboot
Run Code Online (Sandbox Code Playgroud)

但它既不会更改变量location_providers_allowed的值,也不会在重启后在 Android 设置 UI 下将其打开。

我尝试使用相同的命令来设置其他变量,例如mock_location,并且它工作没有问题。这个变量不能改变吗?

安卓版本:M

小智 5

适用于安卓6.0

要启用使用:

对于 GPS :adb shell settings put secure location_providers_allowed +gps

对于网络:adb shell settings put secure location_providers_allowed +network

禁用:

全球定位系统 :adb shell settings put secure location_providers_allowed -gps

对于网络:adb shell settings put secure location_providers_allowed -network