在开启工作资料的安卓设备上用adb启动Intent遇权限问题求助
解决ADB启动工作资料用户Intent的权限问题
针对你遇到的SecurityException: Shell does not have permission to access user 11错误,可尝试以下几种方案:
切换到目标用户执行命令
先通过su切换到工作资料用户的上下文,再启动Intent:# 方法1:分步执行 adb shell su --user 11 am start -W -a android.intent.action.VIEW -d "https://www.myapp.com/link" com.myapp # 方法2:单条命令执行 adb shell su --user 11 am start -W -a android.intent.action.VIEW -d "https://www.myapp.com/link" com.myapp注:部分设备需要Root权限才能使用
su --user切换用户。使用--profile参数指定工作配置文件
工作资料属于主用户的关联配置文件,可先通过adb shell pm list profiles获取配置文件ID,再用--profile参数指定:# 假设主用户ID为0,工作资料配置文件ID为10 adb shell am start --profile 0:10 -W -a android.intent.action.VIEW -d "https://www.myapp.com/link" com.myapp检查设备权限限制
如果是企业管控设备,可能存在ADB跨用户操作的限制,需要联系设备管理员开放权限,或在设备开发者选项中确认ADB的权限设置是否允许跨用户访问。
内容的提问来源于stack exchange,提问作者Subodh Nijsure
相关产品推荐
相关产品推荐

