应用程序可以使用安卓安全机制(PIN 码、图案、密码...)吗? [英] Can app use android security mechanism (pin code, pattern, password...)?

查看:44
本文介绍了应用程序可以使用安卓安全机制(PIN 码、图案、密码...)吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

屏幕锁定有一些很好的安全机制.(例如 pin、密码、图案...)
我的 AP 想要一个类似的安全机制.
是否可以调用屏幕锁定安全机制?
(所以我的AP只需要知道结果,不需要自己处理安全)

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)

推荐答案

我找到了一个方法,供大家参考

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  
        }  
    }  
}

这篇关于应用程序可以使用安卓安全机制(PIN 码、图案、密码...)吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆