Is local_auth package, biometric faceId is working on both Android and IOS ?, i tried many times, but in android only working fingerprint only, faceID is active on my device but still coming fingerprint option anyone know this reason
I tried to work on faceID In android, i gotting mixed review on this topic
2
Answers
Here is my code for both working (Android and iOS)
The
local_auth
package in Flutter primarily supports biometric authentication, including fingerprint and facial recognition. However, the support for face recognition on Android devices can be inconsistent due to hardware and software variations across different Android manufacturers.Here’s a comprehensive guide to using the
local_auth
package for biometric authentication in Flutter and understanding its limitations:Step-by-Step Guide to Implement Biometric Authentication
Step 1: Add Dependencies
Add the
local_auth
package to yourpubspec.yaml
file:Step 2: Update Platform-Specific Configurations
Android Configuration:
AndroidManifest.xml
:android/app/src/main/res/xml/authenticator.xml
:Create a file named
authenticator.xml
in theres/xml
directory and add the following:iOS Configuration:
Info.plist
:Step 3: Implement Biometric Authentication
Create a Dart file to handle biometric authentication:
Explanation and Common Issues
Checking Biometrics:
canCheckBiometrics
method checks if any biometric hardware is available on the device.getAvailableBiometrics
method returns a list of available biometric types (face
,fingerprint
).Authenticating:
authenticate
method triggers the biometric authentication prompt.Common Issues on Android:
local_auth
package. This feature is more consistent on iOS.Testing
By following this setup, you should be able to implement biometric authentication in your Flutter app. However, do keep in mind the limitations and differences in biometric support across different devices and platforms.