Code example for ActivityManager

Methods: killBackgroundProcessesrestartPackage

0
 
		// 杀死Application 
		String packName = context.getPackageName();
		ActivityManager activityMgr = (ActivityManager) context
				.getSystemService(Context.ACTIVITY_SERVICE);
		activityMgr.restartPackage(packName);// 需要权限<uses-permission
		// android:name="android.permission.RESTART_PACKAGES" 
		// /> 
		activityMgr.killBackgroundProcesses(packName);// 需要权限 <uses-permission
		// android:name="android.permission.KILL_BACKGROUND_PROCESSES"/> 
		android.os.Process.killProcess(android.os.Process.myPid());
	} 
}