If you want to implement fingerprint authentication in your app, then the following libraries and examples may be of help to you.

1. FingerAuth

FingerAuth library makes Fingerprint authentication easy.

Below are demo screenshots

Download the sample apk here.

Step 1: Install it

Add this to your root build.gradle file:

allprojects {
    repositories {
        ...
        maven { url 'https://jitpack.io' }
    }
}

Now add the dependency to your app build.gradle file:

implementation 'com.github.marcoscgdev:FingerAuth:1.0.1'

Step 2: Creating FingerPrint dialog

Here is a complete snippet of it usage:

new FingerAuthDialog(this)
        .setTitle("Sign in")
        .setCancelable(false)
        .setMaxFailedCount(3) // Number of attemps, default 3
        .setPositiveButton("Use password", new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialogInterface, int i) {
                // do something
            }
        })
        .setOnFingerAuthListener(new FingerAuth.OnFingerAuthListener() {
            @Override
            public void onSuccess() {
                Toast.makeText(MainActivity.this, "onSuccess", Toast.LENGTH_SHORT).show();
            }

            @Override
            public void onFailure() {
                Toast.makeText(MainActivity.this, "onFailure", Toast.LENGTH_SHORT).show();
            }

            @Override
            public void onError() {
                Toast.makeText(MainActivity.this, "onError", Toast.LENGTH_SHORT).show();
            }
        })
        .show();

Show dialog only on devices that support fingerprint auth:

boolean hasFingerprintSupport = FingerAuth.hasFingerprintSupport(this);

if (hasFingerprintSupport)
    fingerAuthDialog.show();

Step 3: Implementing your own method

new FingerAuth(this)
        .setMaxFailedCount(3) // Number of attemps, default 3
        .setOnFingerAuthListener(new FingerAuth.OnFingerAuthListener() {
            @Override
            public void onSuccess() {
                // do something
            }

            @Override
            public void onFailure() {
                // do something
            }

            @Override
            public void onError() {
                // do something
            }
        });

Step 4: Override strings

<string name="fingerauth_dialog_description">Confirm fingerprint to continue</string>
<string name="fingerauth_dialog_hint">Touch sensor</string>
<string name="fingerauth_dialog_not_recognized">Fingerprint not recognized. Try again</string>
<string name="fingerauth_dialog_success">Fingerprint recognized</string>

FingerAuth Full Example

Here is a full example of how to use this FingerAuth library for Fingerprint authentication:

1. Layouts

We will have only one layout:

activity_main.xml

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="com.marcoscg.fingerprinttest.MainActivity">

    <Button
        android:id="@+id/openDialog"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerInParent="true"
        android:text="Open dialog" />

</RelativeLayout>

2. Code

Below is our code:

MainActivity.java

package com.marcoscg.fingerauthsample;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Toast;

import com.marcoscg.fingerauth.FingerAuth;
import com.marcoscg.fingerauth.FingerAuthDialog;

public class MainActivity extends AppCompatActivity {

    private FingerAuthDialog fingerAuthDialog;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        final boolean hasFingerprintSupport = FingerAuth.hasFingerprintSupport(this);

        findViewById(R.id.openDialog).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                fingerAuthDialog = null;
                if (hasFingerprintSupport)
                    createAndShowDialog();
                else Toast.makeText(MainActivity.this, "Your device does not support fingerprint authentication", Toast.LENGTH_SHORT).show();
            }
        });
    }

    private void createAndShowDialog() {
        fingerAuthDialog = new FingerAuthDialog(this)
                .setTitle("Sign in")
                .setCancelable(false)
                .setPositiveButton("Use password", null)
                .setNegativeButton("Cancel", null)
                .setOnFingerAuthListener(new FingerAuth.OnFingerAuthListener() {
                    @Override
                    public void onSuccess() {
                        Toast.makeText(MainActivity.this, "onSuccess", Toast.LENGTH_SHORT).show();
                    }

                    @Override
                    public void onFailure() {
                        Toast.makeText(MainActivity.this, "onFailure", Toast.LENGTH_SHORT).show();
                    }

                    @Override
                    public void onError() {
                        Toast.makeText(MainActivity.this, "onError", Toast.LENGTH_SHORT).show();
                    }
                });
        fingerAuthDialog.show();
    }
}

Reference

Download code here.
Read more here.
Follow code author here.

Read Individually.