3

在 AndroidManifest.xml 中,我有这个权限:

<user-permission android:name="android.permission.KILL_BACKGROUND_PROCESSES" />

但我仍然收到错误消息:

Permission Denial: killBackgroundProcesses() from ... requires android.permission.KILL_BACKGROUND_PROCESSES

此方法是从以下位置调用的:

    ActivityManager am = (ActivityManager)getSystemService(Context.ACTIVITY_SERVICE);
    final List<RunningAppProcessInfo> runningProcesses = am.getRunningAppProcesses();
    for(RunningAppProcessInfo runningProcess : runningProcesses) {
        if(runningProcess.processName.equals("com.example.nihao")) {
            Log.v("Hello", "kill process "+runningProcess.pid);
            //android.os.Process.killProcess(runningProcess.pid);
            am.killBackgroundProcesses("com.example.nihao");
        }
    }

有什么线索吗?

4

1 回答 1

12

你有错别字,user-permission应该是uses-permission

于 2013-02-22T18:35:15.897 回答