is Phone Sleeping - Android Phone

Android examples for Phone:Phone Information

Description

is Phone Sleeping

Demo Code


//package com.java2s;

import android.app.*;
import android.content.*;

public class Main {

    public static boolean isSleeping(Context context) {
        KeyguardManager kgMgr = (KeyguardManager) context
                .getSystemService(Context.KEYGUARD_SERVICE);
        boolean isSleeping = kgMgr.inKeyguardRestrictedInputMode();
        return isSleeping;
    }/*  w  w w  .  ja v  a  2  s .c  o m*/
}

Related Tutorials