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