Screen lock have some good security mechanism. (like pin, password, pattern...)
My AP would like to have a similar security mechanism.
Is it possible to invoke screen lock security mechanism?
(so my AP just need to know the result and does not need to handle security by itself)
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
I found a way to do that, for someone reference
//put below source code in where you want to launch password UI
km = (KeyguardManager) getSystemService(context.KEYGUARD_SERVICE);
if(km.isKeyguardSecure()) {
Intent i = km.createConfirmDeviceCredentialIntent(null, null);
activity.startActivityForResult(i, 1234);
}
// call back when password is correct
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == 1234) {
if (resultCode == RESULT_OK) {
//do something you want when pass the security
}
}
}