hi i am working in framework side implementing one test app to disable another app but when i run my test app it is showing
Java.lang.SecurityException: Permission Denial: attempt to change component state from pid=xxx,uid=xxxx,package uid=xxx
at xxxxxxxx
my java code
PackageManager pm = getApplicationContext().getPackagemanager();
pm.setComponentEnabledSetting(new ComponentName("com.example","MainActivity"),
PackageManager.COMPONENT_ENABLED_STATE_DISABLED,PackageManager.DONT_KILL_APP);
AndroidManifest.xml
<uses-permission android:name="android.permission.CHANGE_COMPONENT_ENABLED_STATE>
i have tried above permission with both (Permission is only granted to system apps) and also tried tag but no lucky
how to use system apps granted permission,
Could you please guys help me to resolve this issue
Thanks in advance
If you application is not a part of the system partition, then you will not be granted the permission. Get the app into the system partition and confirm that the PackageManager upon parsing your app during the dexopt grants you your desired permission.
You can not Enable/disable app unless your app is system app
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With