<!-- 杀死后台进程-->
<uses-permission android:name="android.permission.KILL_BACKGROUND_PROCESSES"/>
public static void killProcess(ProcessInfo processInfo,Context context) {
//1 进程在activity管理者对象中
ActivityManager am = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
// 杀死指定包名的进程(加权限)
am.killBackgroundProcesses(processInfo.packageName);
}
网友评论