Need help with Biometric-Auth-Sample?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

anitaa1990
231 Stars 125 Forks 16 Commits 15 Opened issues

Description

Add Biometric Authentication to any Android app

Services available

!
?

Need anything else?

Contributors list

# 23,353
worker-...
asyncta...
Android
WordPre...
8 commits
# 227,657
Java
Android
android...
android...
2 commits
# 247,931
Java
fresco
Android
android...
1 commit

Biometric-Auth-Sample

Add Biometric Authentication to any Android app

This library provides an easy way to implement fingerprint authentication without having to deal with all the boilerplate stuff going on inside.

API

How to integrate the library in your app?

Gradle Dependecy

dependencies {
        implementation(group: 'com.an.biometric', name: 'biometric-auth', version: '0.1.0', ext: 'aar', classifier: '')
}

Usage

new BiometricManager.BiometricBuilder(MainActivity.this)
                        .setTitle("Add a title")
                        .setSubtitle("Add a subtitle")
                        .setDescription("Add a description")
                        .setNegativeButtonText("Add a cancel button")
                        .build()
                        .authenticate(biometricCallback);

The

BiometricCallback
class has the following callback methods:
new BiometricCallback() {
              @Override
              public void onSdkVersionNotSupported() {
                     /*  
                      *  Will be called if the device sdk version does not support Biometric authentication
                      */
               }

           @Override
           public void onBiometricAuthenticationNotSupported() {
                 /*  
                  *  Will be called if the device does not contain any fingerprint sensors 
                  */
           }

           @Override
           public void onBiometricAuthenticationNotAvailable() {
                /*  
                 *  The device does not have any biometrics registered in the device.
                 */
           }

           @Override
           public void onBiometricAuthenticationPermissionNotGranted() {
                  /*  
                   *  android.permission.USE_BIOMETRIC permission is not granted to the app
                   */
           }

           @Override
           public void onBiometricAuthenticationInternalError(String error) {
                 /*  
                  *  This method is called if one of the fields such as the title, subtitle, 
                  * description or the negative button text is empty
                  */
           }

           @Override
           public void onAuthenticationFailed() {
                  /*  
                   * When the fingerprint doesn’t match with any of the fingerprints registered on the device, 
                   * then this callback will be triggered.
                   */
           }

           @Override
           public void onAuthenticationCancelled() {
                   /*  
                    * The authentication is cancelled by the user. 
                    */
           }

           @Override
           public void onAuthenticationSuccessful() {
                    /*  
                     * When the fingerprint is has been successfully matched with one of the fingerprints   
                     * registered on the device, then this callback will be triggered. 
                     */
           }

           @Override
           public void onAuthenticationHelp(int helpCode, CharSequence helpString) {
                     /*  
                      * This method is called when a non-fatal error has occurred during the authentication 
                      * process. The callback will be provided with an help code to identify the cause of the 
                      * error, along with a help message.
                      */
            }

            @Override
            public void onAuthenticationError(int errorCode, CharSequence errString) {
                     /*  
                      * When an unrecoverable error has been encountered and the authentication process has 
                      * completed without success, then this callback will be triggered. The callback is provided 
                      * with an error code to identify the cause of the error, along with the error message. 
                      */
             }
          });

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.