Android permission is CHANGE_COMPONENT_ENABLED_STATE

I need to use the 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 really does not work for me.

here is my 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 always logs false .. not sure if I can skip something?

+4
source share
1 answer

First, your application will need <uses-permission>, not <permission>.

-, , (, ) , .

+4

All Articles