1 需求
- 查询位置服务状态
- adb shell cmd location is-location-enabled
- 开启或关闭 位置服务
- adb shell cmd location set-location-enabled true
2 语法
Location service commands:
help or -h
Print this help text.
is-location-enabled [--user ]
Gets the master location switch enabled state. If no user is specified,
the current user is assumed.
set-location-enabled true|false [--user ]
Sets the master location switch enabled state. If no user is specified,
the current user is assumed.
providers
The providers command is followed by a subcommand, as listed below:
add-test-provider [--requiresNetwork] [--requiresSatellite]
[--requiresCell] [--hasMonetaryCost] [--supportsAltitude]
[--supportsSpeed] [--supportsBearing]
[--powerRequirement ]
[--extraAttributionTags ,,...]
Add the given test provider. Requires MOCK_LOCATION permissions which
can be enabled by running "adb shell appops set
android:mock_location allow". There are optional flags that can be
used to configure the provider properties and additional arguments. If
no flags are included, then default values will be used.
remove-test-provider
Remove the given test provider.
set-test-provider-enabled true|false
Sets the given test provider enabled state.
set-test-provider-location --location ,
[--accuracy ] [--time
3 示例
4 参考资料



