Android examples for User Interface:Screen Dormant
is Screen Turned On
//package com.java2s; import android.content.Context; import android.os.Build; import android.os.PowerManager; public class Main { public static boolean isScreenTurnedOn(Context context) { PowerManager powerManager = (PowerManager) context .getSystemService(Context.POWER_SERVICE); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT_WATCH) return powerManager.isInteractive(); //noinspection deprecation return powerManager.isScreenOn(); }//from w w w .j a va2s .co m }