Android Permission Denial: forceStopPackage()

前端 未结 2 804
一整个雨季
一整个雨季 2021-01-16 11:57

I am try to kill another application using forceStopPackage(). But my application shows runtime error.

Error :

jav         


        
相关标签:
2条回答
  • 2021-01-16 12:31

    I know this is ab old thread but i wanted to make sure engineers visiting this thread has latest information.

    android.permission.FORCE_STOP_PACKAGES is signature | priviliged permission hence it needs to go in to system partition under priv-app. So whoever wants to have this permission in their app have to work with respective OEM to pre-load them on to priv-app.

    Starting from Android O: This permission along with App name needs to be declared in one of the permission xml

    privapp-permissions-platform.xml – AOSP Apps privapp-permissions-google.xml – Google Apps privapp-permissions-.xml – OEM/ODM, OEM Associated and others

    <privapp-permissions package="com.abc.android.xyz">
    <permission name="android.permission.FORCE_STOP_PACKAGES"/>
    </privapp-permissions> 
    
    0 讨论(0)
  • 2021-01-16 12:50

    You have to add the permission in the AndroidManifest.xml like below.

    <uses-permission android:name="android.permission.FORCE_STOP_PACKAGES"></uses-permission>
    

    Make sure only if your app is signed with system key os will allow to stop other apps.

    0 讨论(0)
提交回复
热议问题