Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Register user fingerprint in an android application

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.

like image 742
Rohit Saroha Avatar asked Jul 24 '17 10:07

Rohit Saroha


1 Answers

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:

Link1 Link2

like image 150
Amirhossein Naghshzan Avatar answered Sep 29 '22 15:09

Amirhossein Naghshzan