Java tutorial
//package com.java2s; import android.content.Context; import android.os.PowerManager; public class Main { public static boolean isScreenOn(Context ctx) { PowerManager pm = (PowerManager) ctx.getSystemService(Context.POWER_SERVICE); return pm.isScreenOn(); } }