杀死想要杀掉的进程:
在AndroidManifest.xml中配置activity属性android:process=":lthj.xct.process"。
在代码中使用:
ActivityManager mActivityManager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
List<ActivityManager.RunningAppProcessInfo> appProcessList = mActivityManager.getRunningAppProcesses();
for(ActivityManager.RunningAppProcessInfo appProcessInfo : appProcessList){
// 进程名,默认是包名或者由属性android:process=""指定
String processName = appProcessInfo.processName;
if(processName.contains(":lthj.xct.process")){
Logger.i("info","processName="+processName);
// mActivityManager.killBackgroundProcesses(processName);
android.os.Process.killProcess(appProcessInfo.pid);
}
}