Android的许可 - CHANGE_COMPONENT_ENABLED_STATE [英] android permission - CHANGE_COMPONENT_ENABLED_STATE

查看:2367
本文介绍了Android的许可 - CHANGE_COMPONENT_ENABLED_STATE的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要使用android.permission.CHANGE_COMPONENT_ENABLED_STATE权限在我的code,因为我需要更新我的项目的另一个APK的组件,但它不似乎真的为我工作。

i need to use android.permission.CHANGE_COMPONENT_ENABLED_STATE permission in my code because i need to update the component of another apk of my project, but it don't seems really work for me

这是我的code:

<permission
    android:name="android.permission.CHANGE_COMPONENT_ENABLED_STATE"
    android:protectionLevel="signatureOrSystem"/>

final int permission = ctx.checkCallingPermission(android.Manifest.permission.CHANGE_COMPONENT_ENABLED_STATE);

final boolean allowedByPermission = (permission == PackageManager.PERMISSION_GRANTED);
L.d(TAG, "allowedByPermission :" + allowedByPermission + " permission:" + permission);
if(allowedByPermission) {}

allowedByPermission总是登录虚假..不知道如果我能错过了什么?

allowedByPermission always log a false.. not sure if i could miss something?

推荐答案

首先,你的应用程序将需要&LT;使用-许可&GT; ,不是 &LT;许可&GT;

First, your app would need <uses-permission>, not <permission>.

二,你的应用程序不能持有该权限,除非它被安装在系统分区(例如,通过一个植根设备用户)或通过签订系统固件相同的签名密钥签名。

Second, your app cannot hold that permission, unless it is installed on the system partition (e.g., by a rooted device user) or is signed by the same signing key that signed the system firmware.

这篇关于Android的许可 - CHANGE_COMPONENT_ENABLED_STATE的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆