List of usage examples for android.view Display STATE_OFF
int STATE_OFF
To view the source code for android.view Display STATE_OFF.
Click Source Link
From source file:com.mathi_amorim.emmanuel.metrictime.UpdateTimeService.java
public boolean isScreenOn() { if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT_WATCH) { DisplayManager dm = (DisplayManager) getSystemService(Context.DISPLAY_SERVICE); boolean screenOn = false; for (Display display : dm.getDisplays()) { if (display.getState() != Display.STATE_OFF) { screenOn = true;/* w w w . j a v a2s. com*/ } } return screenOn; } else { PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE); //noinspection deprecation return pm.isScreenOn(); } }