【发布时间】:2021-02-16 07:49:12
【问题描述】:
是否可以为 AWS 设备场中的 espresso 仪器测试授予安全权限?我需要授予“android.permission.ACCESS_BACKGROUND_LOCATION”,在 Android 10 及更高版本中它是安全的,并且只能在应用程序的系统设置中授予。
【问题讨论】:
标签: android android-instrumentation aws-device-farm
是否可以为 AWS 设备场中的 espresso 仪器测试授予安全权限?我需要授予“android.permission.ACCESS_BACKGROUND_LOCATION”,在 Android 10 及更高版本中它是安全的,并且只能在应用程序的系统设置中授予。
【问题讨论】:
标签: android android-instrumentation aws-device-farm
您可以在 pre_test 阶段使用以下示例命令在自定义 YML 文件中为 espresso 仪器测试授予安全权限
# These next lines set the permissions of the app
- adb shell pm grant io.appium.settings android.permission.ACCESS_COARSE_LOCATION
- adb shell pm grant io.appium.settings android.permission.ACCESS_FINE_LOCATION
- adb shell pm grant io.appium.settings android.permission.CHANGE_CONFIGURATION
- adb shell am start -W -n io.appium.settings/.Settings -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -f 0x10200000
- adb shell appops set io.appium.settings android:mock_location allow
【讨论】: