Java tutorial
//package com.java2s; import android.app.KeyguardManager; import android.content.Context; public class Main { public static boolean haveLockScreen(Context context) { KeyguardManager km = (KeyguardManager) context.getSystemService(Context.KEYGUARD_SERVICE); return km.inKeyguardRestrictedInputMode(); } }