我正在尝试编写一个进程来杀死在后台运行的应用程序,但这些应用程序仍然显示在最近的应用程序列表中并且没有死:
ActivityManager am = (ActivityManager) getApplicationContext().getSystemService(
Context.ACTIVITY_SERVICE);
List<ActivityManager.RunningTaskInfo> processList = am.getRunningTasks(5);
for(int i=0; i<processList.size();i++){
cProcess = processList.get(i).baseActivity.getPackageName();
if(!allowedApps.contains(cProcess)){
am.killBackgroundProcesses(cProcess);
Log.v("","---------------------------------------------------------kill-----"+cProcess);
}
}