Register user fingerprint in Android app

I want to create an Android app that enrolls a user's fingerprint (from the device's fingerprint reader) and stores it in a data structure or key store, next time the user puts their fingerprint reader it must be authenticated from the stored fingerprints to data structure or from the android keystore provider. If anyone can help me how to approach this. Thank you in advance.

+3


source to share


1 answer


Sorry, but as far as I know, there is no way to enroll a fingerprint. The user must register their finger in the settings. You can just check the user's fingerprint for authentication. If there is no enrolled finger or no fingerprint sensor, lightly fry 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 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 Settings", Toast.LENGTH_LONG).show();
        }

      



Check out this guide to understand how to verify a user's fingerprint:

Link1 Link2

0


source







All Articles