Programmatically check if Android PIN lock is active

Here's what: I am making a security application that should check if a PIN is set or not. The official API returns the same value regardless of the state of the PIN, and I experimented with ITelephony, but I can not get it to work. Any help please?

+3
source share
1 answer

Workaround!

@override
protected void onPause() {
  super.onPause();
  PowerManager powerManager = (PowerManager) getSystemService(POWER_SERVICE);
  boolean isScreenOn = powerManager.isScreenOn();
  if (!isScreenOn) {
    // do stuff...
  }
}
-1
source

All Articles