Skip to content

Latest commit

 

History

History
59 lines (41 loc) · 1.72 KB

File metadata and controls

59 lines (41 loc) · 1.72 KB

Biometric-App-Lock

Add Biometric Authentication to any Android app

This application uses android Biometric Prompt Library to authenticate user using fingerprint.

API

Main Part

How to integrate the library in your app?

Gradle Dependecy
dependencies {
        implementation 'androidx.biometric:biometric:1.0.0-alpha03'
}

Usage

new BiometricPrompt.PromptInfo.Builder()
                .setTitle("Login")
                .setSubtitle("Login to your account!")
                .setDescription("Place your finger on the device home button to verify your identity")
                .setNegativeButtonText("CANCEL")
                .build();

The BiometricPrompt class has the following callback methods:

new BiometricPrompt(activity, executor, new BiometricPrompt.AuthenticationCallback() {
            @Override
            public void onAuthenticationError(int errorCode, @NonNull CharSequence errString) {
                super.onAuthenticationError(errorCode, errString);
                // ................
            }

            @Override
            public void onAuthenticationSucceeded(@NonNull BiometricPrompt.AuthenticationResult result) {
                super.onAuthenticationSucceeded(result);
                // .............
            }

            @Override
            public void onAuthenticationFailed() {
                super.onAuthenticationFailed();
               // ................
            }
        });