1. 程式人生 > >Android Kill Process

Android Kill Process

錯誤 pan oid lose col lex manage () ces

/**********************************************************************
 *                   Android Kill Process 
 * 說明:
 *     在Android App中殺死其他的App進程。
 *
 *                                2017-8-5 深圳 龍華樟坑村 曾劍鋒
 *********************************************************************/


一、參考文檔:
    
1. Why KILL_BACKGROUND_PROCESSES doesnt work? [closed] https://stackoverflow.com/questions/15030863/why-kill-background-processes-doesnt-work 二、處理代碼: ... ActivityManager manager = (ActivityManager)getSystemService(ACTIVITY_SERVICE); try { manager.killBackgroundProcesses(
"com.example.xxx"); } catch (Exception ex) { Log.e(TAG, ex.toString()); } ... 三、錯誤現象: W/ActivityManager( 506): Permission Denial: killBackgroundProcesses() from pid=11476, uid=10043 requires android.permission.KILL_BACKGROUND_PROCESSES E/AplexOS (11476): java.lang.SecurityException: Permission Denial: killBackgroundProcesses() from
pid=11476, uid=10043 requires android.permission.KILL_BACKGROUND_PROCESSES 四、解決辦法: 添加權限:<user-permission android:name="android.permission.KILL_BACKGROUND_PROCESSES" />

Android Kill Process