Code example for DevicePolicyManager

Methods: isAdminActivelockNow

0
	@Override 
	protected void onPause() { 
		super.onPause(); 
		Log.i("LockActivity", "onPause");
 
		if (policyManager.isAdminActive(componentName)) {
			if(config.isCompatibleMode()){
				Settings.System.putInt(getContentResolver(), Settings.System.SCREEN_OFF_TIMEOUT, defaultimeout);
			} 
			policyManager.lockNow();
			exitProcess(); 
		} 
	} 
	 
	//重写此方法用来在第一次激活设备管理器之后锁定屏幕  
	@Override 
	protected void onActivityResult(int requestCode, int resultCode, Intent data) {
		if (policyManager.isAdminActive(componentName)) {
			if(config.isCompatibleMode()){
				try 
Stop searching for code, let great code find you!  Add Codota to your java IDE