ActivityManager am = (ActivityManager) mContext.getSystemService(Activity.ACTIVITY_SERVICE);Please refer to http://developer.android.com/reference/android/app/ActivityManager.html#killBackgroundProcesses(java.lang.String)
List<RunningTaskInfo> tasks =am.getRunningTasks(Integer.MAX_VALUE);
for(int i=0;i<tasks.size();i++)
{
String packageName = tasks.get(i).baseActivity.getPackageName();
am.killBackgroundProcesses(packageName);
}
Also you can kill running apps, services by using API: getRunningAppProcesses(), getRunningServices()
No comments:
Post a Comment