开发者

Programmatically check if PIN lock is active in Android

开发者 https://www.devze.com 2023-03-06 09:58 出处:网络
Here\'s the thing - I\'m doing a securi开发者_开发知识库ty app that needs to be able to check if the PIN code is set or not. The official API returns the same value regardless of the PIN state, and I\

Here's the thing - I'm doing a securi开发者_开发知识库ty app that needs to be able to check if the PIN code is set or not. The official API returns the same value regardless of the PIN state, and I've been experimenting with ITelephony, but can't seem to get it to work. Any help, please?


Workaround!

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

精彩评论

暂无评论...
验证码 换一张
取 消