is Device Sleeping - Android Android OS

Android examples for Android OS:Device

Description

is Device Sleeping

Demo Code

import android.app.KeyguardManager;
import android.content.Context;

public class Main {

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

}

Related Tutorials