If you are asking "how can I ask the system to re-authenticate the user?", on Android 5.0+, something like this should work:
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) {
KeyguardManager km = (KeyguardManager) getSystemService(KEYGUARD_SERVICE);
if (km.isKeyguardSecure()) {
Intent authIntent = km.createConfirmDeviceCredentialIntent(getString(R.string.dialog_title_auth), getString(R.string.dialog_msg_auth));
startActivityForResult(authIntent, INTENT_AUTHENTICATE);
}
}
You can see that code in use (with slight modifications) in the andOTP project.
If you are asking "how can I get the user's password/pin/pattern for my own use?", that is not possible.
Use this to see if the user successfully authenticated:
// call back when password is correct
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == INTENT_AUTHENTICATE) {
if (resultCode == RESULT_OK) {
//do something you want when pass the security
}
}
}