Code example for KeyguardManager

Methods: inKeyguardRestrictedInputMode

0
		    	 
		    	KeyguardManager myKM = (KeyguardManager) context.getSystemService(Context.KEYGUARD_SERVICE);
		    	 
		        if (intent.getAction().equals(Intent.ACTION_SCREEN_OFF)) {
//		            if(wasScreenOn){ 
		        	if( myKM.inKeyguardRestrictedInputMode()) {
		        	 
			        	Intent i = new Intent(context, ViewOnLockScreen.class);
			    		i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
			        	context.startActivity(i);
		        	} 
// 
		        } else if (intent.getAction().equals(Intent.ACTION_SCREEN_ON)) {
//		            if(!wasScreenOn){ 
//		        	Intent i = new Intent(context, ViewOnLockScreen.class); 
//		        	context.startActivity(i); 
//		            wasScreenOn = true; 
//		            } 
 
		        } 
		    }