I want to make an android application, which registers user fingerprint (from device's fingerprint scanner) and stores it in a data structure or in key store provider, next time user put his fingerprint scanner, he should be authenticated from the fingerprints stored in the data structure or from the android keystore provider. If anyone can help me how to approach for this. Thanks in advance.
Sorry but as far as I know, no way to register fingerprint. User should register his/her finger in settings. You can just check user fingerprint for Authentication. If there is no registered finger or has no fingerprint sensor, easily toast it.
//Check whether the device has a fingerprint sensor//
if (!mFingerprintManager.isHardwareDetected()) {
// If a fingerprint sensor isn’t available, then inform the user that they’ll be unable to use your app’s fingerprint functionality//
textView.setText("Your device doesn't support fingerprint authentication");
}
//Check whether the user has granted your app the USE_FINGERPRINT permission//
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.USE_FINGERPRINT) != PackageManager.PERMISSION_GRANTED) {
// If your app doesn't have this permission, then display the following text//
Toast.makeText(EnterPinActivity.this, "Please enable the fingerprint permission", Toast.LENGTH_LONG).show();
}
//Check that the user has registered at least one fingerprint//
if (!mFingerprintManager.hasEnrolledFingerprints()) {
// If the user hasn’t configured any fingerprints, then display the following message//
Toast.makeText(EnterPinActivity.this, "No fingerprint configured. Please register at least one fingerprint in your device's Settings", Toast.LENGTH_LONG).show();
}
//Check that the lockscreen is secured//
if (!mKeyguardManager.isKeyguardSecure()) {
// If the user hasn’t secured their lockscreen with a PIN password or pattern, then display the following text//
Toast.makeText(EnterPinActivity.this, "Please enable lockscreen security in your device's Settings", Toast.LENGTH_LONG).show();
}
Check this tutorials to understand how check user fingerprint: