Android Fingerprint Authentication

Android Fingerprint Authentication

Android fingerprint authentication uses smartphone touch sensor to authenticate the user. Android Marshmallow has introduced a set of API that makes it easy to use the touch sensor. Before Android Marshmallow, the method to access the touch sensor was not standard.

There are several benefits of using Android fingerprint authentication:

1. Doesn’t matter how sick you are , your fingerprint still stays faultless as your identity and can never be misplaced.
2. Fast, Convenient and Reliable to use.
3. Unique fingerprints assure that it’s unlocked just by you.
4. With the help of Fingerprint authentication, online transactions become more convenient, hence your just a tap away from getting verified.

NOTE: Make sure you have at least one fingerprint is registered on the smartphone.

To authenticate users using the fingerprint sensor, you need to get an instance of the newly implemented FingerprintManager class and call the authenticate() method. However your app must be running on a compatible device which includes a fingerprint sensor. Moreover you must implement the user interface for the fingerprint authentication flow on your app, and use the standard Android fingerprint icon in your UI. Note that If you are developing multiple apps that use fingerprint authentication, each app must authenticate the user’s fingerprint separately.


In this tutorial, we are going to learn how to implement Fingerprint Authentication in your application.


1. Create a new project in Android Studio by navigating to File ⇒ New ⇒ New Project and fill required details. By default my activity is

2. Open res ⇒ values ⇒ strings.xml and add below string values. These are some strings that we are going to use in our project.

3. Since we are going to work with Fingerprint authentication, we need to add USE_FINGERPRINT permission to AndroidManifest.xml file

4. Create the fingerprint icon with the help of Android Vector Assets. To do so, Right click on the drawable folder and Create a New ⇒ Vector Asset named ic_fingerprint_white_60dp.xml.

5. Now, open your activity_main.xml layout and place the below code.

6. Now open your class and place the below code. The following class includes various steps as follows:

  • Access to Android KeyStore and Generate the Key : generateKey() function which generates an encryption key which is then stored securely on the device.
  • Create the Android Cipher : cipherInit() function that initialises the cipher that will be used to create the encrypted FingerprintManager.
  • CryptoObject instance and various other checks before initiating the authentication process which is implemented inside onCreate() method.

Full Code

7. Now create Welcome activity which will open on successful Fingerprint Authentication.

  • welcome_activity.xml
8. Create a Fingerprint Authentication Handler class and name it The Handler class extends FingerprintManager.AuthenticationCallback and includes some additional modules so that we can receive event notification and we can know when the authentication succeeded or something went wrong.

There are some important methods to notice. First of all, the doAuth that starts the authentication process. This method has the CryptoObject, a cancellation signal and the callback listener (this class).

9. Finally you are all done. Now you can test your app in Physical Device or in Emulator. To test the app in emulator follow below steps:

  • Install Android SDK Tools Revision 24.3, if you have not done so.
  • Enroll a new fingerprint in the emulator by going to Settings ⇒ Security ⇒ Fingerprint, then follow the enrolment instructions.

Use an emulator to emulate fingerprint touch events with the following command. Use the same command to emulate fingerprint touch events on the lockscreen or in your app.

Thanks. :)

Download Source Code


About the author

I am an Android developer for whom Android is the one and only love. I work as a freelancer which gets me and Android closer. I always love to share my learnings and love to learn from others knowledge too.


Hi Zomby77,

Can you tell where you are facing issue?



I am not a developer so it’s not clear to me how to make the authentication pass … otherwise I write that I do not have a fingerprint sensor!

* An error message will be displayed if the device does not contain the fingerprint hardware.
* However if you plan to implement a default authentication method,
* you can redirect the user to a default authentication activity from here or can skip this method.
* Example:
* Intent intent = new Intent(this, YourActivity.class);
* startActivity(intent);
* finish();

It’s unclear how I can transfer authenticates to samsung pass 😀
Thank you very much for your reply

    Hi Zomby77,

    Can we have TeamViewer session so i can help you properly.



Yes i have 🙂

Leave a Comment

Comment (required)

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">

Name (required)
Email (required)