Google is committed to advancing racial equity for Black communities. See how.

Biometric

Authenticate with biometrics or device credentials, and perform cryptographic operations.
Latest Update Current Stable Release Next Release Candidate Beta Release Alpha Release
November 11, 2020 1.0.1 1.1.0-rc01 - -

Declaring dependencies

To add a dependency on Biometric, you must add the Google Maven repository to your project. Read Google's Maven repository for more information.

Add the dependencies for the artifacts you need in the build.gradle file for your app or module:

dependencies {
    implementation "androidx.biometric:biometric:1.0.1"
  }

For more information about dependencies, see Add Build Dependencies.

Feedback

Your feedback helps make Jetpack better. Let us know if you discover new issues or have ideas for improving this library. Please take a look at the existing issues in this library before you create a new one. You can add your vote to an existing issue by clicking the star button.

Create a new issue

See the Issue Tracker documentation for more information.

Version 1.1.0

Version 1.1.0-rc01

November 11, 2020

androidx.biometric:biometric:1.1.0-rc01 is released. Version 1.1.0-rc01 contains these commits.

Bug Fixes

  • Fixed an issue on some devices where certain actions (authenticating, canceling, etc.) would sometimes throw a NullPointerException. (b/151316421)
  • Fixed an issue where some Pixel devices would report the wrong status when using BiometricManager#canAuthenticate(int) to check for Class 3 biometrics on Android 10. (b/170406186)

Version 1.1.0-beta01

October 1, 2020

androidx.biometric:biometric:1.1.0-beta01 is released. Version 1.1.0-beta01 contains these commits.

New Features

  • Significantly reduced the library's APK size footprint (by >100 KB compressed, in some cases) by replacing dialog animations with static assets on Android 8.1 and earlier. (I4844e)
  • BiometricPrompt now automatically falls back to device credential authentication (if allowed) on all supported Android versions when biometric authentication is locked out. (b/149579143)

Bug Fixes

  • Fixed an issue where BiometricPrompt caused a crash on some Android 9 devices without a fingerprint sensor. (b/151443237)
  • Fixed a potential NullPointerException in FingerprintDialogFragment. (b/167951429)
  • Fixed an issue where the wrong CryptoObject type was used for a reflective method invocation in BiometricManager. (b/165824669)
  • Fixed an issue where showing BiometricPrompt again shortly after dismissal caused the new prompt to be dismissed automatically on some Android 10 devices. (b/157783075)
  • Fixed memory leaks related to the use of FingerprintManagerCompat. (b/165840273)
  • Fixed issues with the fingerprint dialog UI being hidden or shown incorrectly on some Android 9 devices. (b/154868505, b/148350291)

Version 1.1.0-alpha02

August 19, 2020

androidx.biometric:biometric:1.1.0-alpha02 is released. Version 1.1.0-alpha02 contains these commits.

New Features

  • BiometricManager#canAuthenticate() may now return BIOMETRIC_STATUS_UNKNOWN to indicate that the user may still be able to authenticate, or BIOMETRIC_ERROR_UNSUPPORTED to indicate that a given authenticator combination is not supported by the device.
  • BiometricPrompt#authenticate() may now be used for device credential authentication with an associated CryptoObject on Android 11 (API level 30) and above only.

API Changes

Bug Fixes

  • Fixed memory leaks reported by LeakCanary in BiometricFragment and BiometricViewModel. (b/144919472)
  • Ensured that BiometricViewModel will no longer call MutableLiveData#setValue() from a background thread. (b/159983244)
  • Fixed an issue where BiometricPrompt was not correctly handling temporary lockout on some API levels. (9acfce9)
  • Fixed an issue where BiometricPrompt would return the wrong error code for a device not secured with a screen lock credential on some API levels. (b/148626482)
  • Fixed an issue where BiometricManager and BiometricPrompt would return the wrong error codes for a device with no keyguard implementation on some API levels. (891c6e0)

Version 1.1.0-alpha01

June 24, 2020

androidx.biometric:biometric:1.1.0-alpha01 is released. Version 1.1.0-alpha01 contains these commits.

New Features

  • Refactored the internal library implementation to address potential sources of memory leaks and other unintended behavior:
    • Internal fragments now share and persist data using a ViewModel that is tied to the client application's activity lifecycle.
    • Device credential authentication prior to Android 10 (API level 29) no longer starts a transparent activity within the client application.

Bug Fixes

  • Resolved deprecation warnings related to the use of FingerprintManagerCompat. (b/142967618)
  • Changed how SDK-gated platform methods are called to avoid class verification issues on older Android versions. (94beb4b)
  • Gradle dependencies that are not part of the public API are no longer exported by the library. (f289d9e)

Version 1.0.1

Version 1.0.1

December 18, 2019

androidx.biometric:biometric:1.0.1 is released. Version 1.0.1 contains these commits.

Bug fixes

  • Extended the existing fingerprint fallback workaround for crypto-based authentication to known affected vendors, while also limiting it to API 28 (b/143361271)
  • Fixed an issue on certain devices where the biometric dialog was shown under a system overlay (b/143230260)
  • Fixed several issues with setDeviceCredentialAllowed(true) (b/143091227, b/143097321, b/143653944)
  • Fixed an issue on certain Android versions where onAuthenticationSuccess was not always called after the user confirmed their device credential (b/145232806)
  • Fixed an issue on certain Android versions where onAuthenticationError was not always called when the prompt was dismissed on rotation (b/145230042)
  • Fixed an issue on certain Android versions where the prompt was not dismissed when receiving certain error codes (b/143683687)
  • Fixed a potential NullPointerException in BiometricFragment (b/142599311)

Version 1.0.0

Version 1.0.0

November 7, 2019

androidx.biometric:biometric:1.0.0 is released with no changes since 1.0.0-rc02. Version 1.0.0 contains these commits.

Major features of 1.0.0

  • Compatibility version of the BiometricPrompt and BiometricManager APIs, as implemented in Android 10, with full feature support back to Android 6.0 (API 23)
  • Built-in lifecycle management for BiometricPrompt within a Fragment or FragmentActivity
  • Special handling for devices known to incorrectly present weak biometrics during crypto-based authentication

Version 1.0.0-rc02

October 23, 2019

androidx.biometric:biometric:1.0.0-rc02 is released. Version 1.0.0-rc02 contains these commits.

Bug fixes

  • Added a workaround for certain devices that are known to incorrectly provide a weak biometric when crypto-based authentication is invoked on API versions 28 and 29 (b/142150327)

Version 1.0.0-rc01

October 9, 2019

androidx.biometric:biometric:1.0.0-rc01 is released. Version 1.0.0-rc01 contains these commits.

Bug fixes

  • Fixed a potential crash with FingerprintDialogFragment when dismissing it while the screen is rotating (b/141356362)
  • Fixed an issue where receiving a null AuthenticationResult from the framework API could cause a crash (b/138862251)
  • Fixed crashes caused by BiometricPrompt being dismissed after onSaveInstanceState() (b/138825362, b/140447194)

Version 1.0.0-beta02

September 18, 2019

androidx.biometric:biometric:1.0.0-beta02 is released. Version 1.0.0-beta02 contains these commits.

Bug fixes

  • Fixed issues with device credential support in version 1.0.0-beta01
  • Removed Java 8 dependencies and switched to depending on Java 7 (b/140508526)
  • FingerprintHelperFragment now correctly throws ERROR_HW_NOT_PRESENT when no fingerprint hardware is detected (b/140427586)

Version 1.0.0-beta01

August 29, 2019

androidx.biometric:biometric:1.0.0-beta01 is released. Version 1.0.0-beta01 contains these commits.

New features

We’ve introduced a second constructor for BiometricPrompt that allows it to be hosted in a Fragment (as opposed to the existing constructor, which requires a FragmentActivity).

We’re also excited to bring the following functionality from Android 10 to the AndroidX Biometric library:

  1. BiometricManager#canAuthenticate
  2. BiometricPrompt.PromptInfo#setConfirmationRequired
  3. BiometricPrompt.PromptInfo#setDeviceCredentialAllowed

On Android 10, the library will invoke the corresponding methods from the platform API. On older API levels, the library will emulate the behavior.

API changes

  • Added fragment-specific constructor for biometric prompt (b/131980596)
  • See the “New features” section above.

Bug fixes

  • Add BiometricPrompt device credential support for L+
  • Fixed BiometricPrompt to use public error constants (b/137788194)
  • Fix NullPointerException in BiometricPrompt.onAttach() (b/136103103)
  • Changed behavior to not allow BiometricPrompt to be cancelled by a touch event outside the prompt (b/135684487)
  • Fixed onAuthenticationError crash when a null error value is returned in Kotlin (b/128350861)
  • FingerprintDialogFragment is now style-able (b/127878106)
  • FingerprintDialog is now scrollable (b/126367887)
  • Fixed bug where rotating the biometric dialog raises an IllegalStateException (b/124153656), (b/123811924)
  • Fixed inconsistent behavior on API Levels 23 to 27. (b/124066957)
  • Fixed issue where Fingerprint Login Dialog read incorrect text using Talkback. (b/123572331)

Version 1.0.0-alpha04

April 3, 2019

androidx.biometric:biometric:1.0.0-alpha04 is released. The commits included in this version can be found here.

Bug fixes

  • Fixed Biometric fragments don't clean up in all cases. (b/121117380)
  • Fixed BiometricPrompt only allows one instance of BiometricPrompt.AuthenticationCallback (b/123857949)
  • Fixed BiometricPrompt error behavior inconsistent between system and compat versions. (b/123572326)
  • Fixed callback onAuthenticationError() with @NotNull errString causes NullPointerException at runtime (b/123167217)
  • Fixed androidx.BiometricPrompt Cancel button Crashes (b/122054485)
  • Fixed androidx.biometric.PromptInfo title/description not changed on Android P (b/122856773)

Version 1.0.0-alpha03

December 17, 2018

Bug fixes

  • Fixed fragment-related issues
  • On devices O and older, lockout errors are returned immediately to be consistent with P and above