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