This is a demo project showcasing the implementation of Android Biometric Authentication using Jetpack Compose.
Biometric authentication provides a secure and convenient way for users to access applications using their biometric data such as fingerprint, face, or iris recognition. This project demonstrates the integration of biometric authentication into an Android application using Jetpack Compose, making the authentication process seamless and user-friendly.
- Utilizes the latest Android Biometric APIs
- Supports both strong biometric authentication and device credential fallback
- Handles various authentication scenarios and error conditions gracefully
- Provides a clean and intuitive user interface built with Jetpack Compose
- Android Studio Arctic Fox (2020.3.1) or higher
- Android SDK 30 or above
- Kotlin 1.5.0 or above
-
Clone the repository to your local machine:
git clone https://github.com/Hasnain17/BioMetricAuth.git
-
Open the project in Android Studio.
-
Build and run the project on an Android device or emulator.
-
Launch the application on your device.
-
Tap on the "Authenticate" button to initiate the biometric authentication process.
-
Follow the on-screen prompts to authenticate using your enrolled biometric data.
-
Depending on the device and authentication status, you may encounter various outcomes such as successful authentication, authentication failure, or prompts to set up biometric authentication if not already configured.
##Flow
The application displays a button labeled "Authenticate". Clicking the button triggers the biometric prompt with a title of "Sample Prompt" and description of "Sample prompt description".
The app handles different biometric results and displays informative messages accordingly:
-
Authentication Success: "Authentication Success"
-
Authentication Failed: "Authentication Failed"
-
Authentication Error: Displays the specific error message.
-
Authentication Not Set: If biometrics are not enrolled on the device (Android versions below 30), it displays "Authentication not set". On Android 30+, it guides the user to the system settings for enrolling biometrics.
-
Hardware Unavailable: "Hardware Unavailable" (e.g., no fingerprint sensor or face recognition camera).
-
Feature Unavailable: "Feature Unavailable" (Biometric authentication is not supported on the device).
##Dependencies
-
AndroidX Biometric library
-
Jetpack Compose
Contributions are welcome! If you'd like to contribute to this project, please fork the repository and submit a pull request with your changes.
This project is licensed under the MIT License - see the LICENSE file for details.