is Screen On from PowerManager - Android User Interface

Android examples for User Interface:Screen Dormant

Description

is Screen On from PowerManager

Demo Code


//package com.java2s;

import android.content.Context;

import android.os.PowerManager;

public class Main {

    public static boolean isScreenOn(Context context) {
        PowerManager pm = (PowerManager) context
                .getSystemService(Context.POWER_SERVICE);
        boolean screen = pm.isScreenOn();

        return screen;
    }/*from w  w  w. j a v  a 2 s  .  c o  m*/
}

Related Tutorials