Example usage for android.os PowerManager isScreenOn

List of usage examples for android.os PowerManager isScreenOn

Introduction

In this page you can find the example usage for android.os PowerManager isScreenOn.

Prototype

@Deprecated
public boolean isScreenOn() 

Source Link

Document

Returns true if the device is in an interactive state.

Usage

From source file:Main.java

public static boolean isScreenOn(Context ctx) {
    PowerManager pm = (PowerManager) ctx.getSystemService(Context.POWER_SERVICE);
    return pm.isScreenOn();
}

From source file:Main.java

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

From source file:Main.java

/**
 * return if screen on//from www  .j a v  a  2s.  c  o m
 * @param context
 * @return
 */
public static boolean isScreenOn(Context context) {
    PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
    return pm.isScreenOn();
}

From source file:Main.java

public static boolean isDisplayOn(Context context) {
    PowerManager powerManager = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
    return powerManager.isScreenOn();
}

From source file:Main.java

public static final boolean isScreenOn(Context context) {
    PowerManager powerManager = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
    return powerManager.isScreenOn();
}

From source file:Main.java

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

From source file:Main.java

private static boolean isScreenOffOrLocked(Context context) {
    KeyguardManager keyguardManager = (KeyguardManager) context.getSystemService(Context.KEYGUARD_SERVICE);
    PowerManager powerManager = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
    boolean off = !powerManager.isScreenOn();
    off |= keyguardManager.inKeyguardRestrictedInputMode();
    return off;//from   ww w  . ja  v  a2 s .co m
}

From source file:Main.java

@SuppressWarnings("deprecation")
public static boolean isInteractive(PowerManager pm) {
    boolean result = false;

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT_WATCH) {
        result = pm.isInteractive();/*from w  w  w.j  ava 2s .c o m*/
    } else {
        result = pm.isScreenOn();
    }

    return result;
}

From source file:Main.java

/**
 * @return Whether the screen of the device is interactive.
 */// w ww. j ava  2  s.c o  m
@SuppressWarnings("deprecation")
public static boolean isInteractive(Context context) {
    PowerManager manager = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT_WATCH) {
        return manager.isInteractive();
    } else {
        return manager.isScreenOn();
    }
}

From source file:com.grarak.kerneladiutor.utils.Utils.java

public static boolean isScreenOn(Context context) {
    PowerManager powerManager = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT_WATCH) {
        return powerManager.isInteractive();
    }/*from   w  w w  . j  a v  a 2  s.  c om*/
    return powerManager.isScreenOn();
}