AWS Device Farm - Android Instrumented 测试的权限

问题描述

是否可以为 AWS 设备群中的浓缩咖啡仪器测试授予安全权限?我需要授予“android.permission.ACCESS_BACKGROUND_LOCATION”,在 Android 10 及更高版本中它是安全的,只能在应用的系统设置中授予。

解决方法

您可以在 pre_test 阶段使用以下示例命令在自定义 YML 文件中授予浓缩咖啡仪器测试的安全权限

# 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