【安卓开发】Permission Denial: broadcast asks to run as user -2 but is calling from user 0;报错解决方案
报错问题:Permission Denial: broadcast asks to run as user -2 but is calling from user 0;
·
报错问题:Permission Denial: broadcast asks to run as user -2 but is calling from user 0;
this requires android.permission.INTERACT_ACROSS_USERS_FULL or android.permission.INTERACT_ACROSS_USERS
解决:
1、权限问题
添加
<uses-permission android:name="android.permission.INTERACT_ACROSS_USERS_FULL"
tools:ignore="ProtectedPermissions" android:protectionLevel="signature"/>
<uses-permission android:name="android.permission.INTERACT_ACROSS_USERS"
tools:ignore="ProtectedPermissions" android:protectionLevel="signature"/>
2、用户权限
String cmd = "am broadcast --user 0 -a android.intent.action.NAVIBAR_STATUSBAR --ez show false"
Runtime mRuntime = Runtime.getRuntime();
Process mProcess = mRuntime.exec(cmd);
更多推荐
已为社区贡献5条内容
所有评论(0)