2016-08-29 41 views

回答

1

我找到了一種方法來做到這一點,有人引用

//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 
     } 
    } 
} 
相關問題