Reputation: 433
I was implementing biometrics in my app for authentication. I am using react-native biometrics for it. Every things working good just one stucked. Face-id is not working in Android. I did a lot of googling but unable to find some satisfactory answer. Is it even possible to use face-id in Android?
Biometrics.isSensorAvailable()
.then((biometryType) => {
if (biometryType === Biometrics.TouchID) {
console.log('TouchID is supported')
} else if (biometryType === Biometrics.FaceID) {
console.log('FaceID is supported')
} else {
console.log('Biometrics not supported')
}
})
This always return me TouchId even if I am using FaceId in my phone. Thank for help in advance.
Upvotes: 14
Views: 11229
Reputation: 394
From my recent research it seems that expo-local-authentication works with face recognition, but only if device has fingerprint authentication hardware also.
Expo-local-authentication
function supportedAuthenticationTypesAsync()
returns always only information about AuthenticationType.FINGERPRINT
even if facial recognition is also available on android device. Despite that it works properly even if device with fingerprint hardware doesn't have fingerprint data and has only face data. Then expo-local-authentication
use face unlock.
Problem happens when android device doesn't have fingerprint hardware, but have face recognition availability. Then supportedAuthenticationTypesAsync()
returns only undefined
and authenticateAsync()
doesn't work.
Here is snack created for testing: https://snack.expo.dev/-Y34x2K7- But you will need a device with such hardware.
I prepared precise question here to find solution for case with android devices with face recognition unlock but without fingerprint unlock here: Face Id, biometry, face recognition unlock on Android devices in React Native
Upvotes: 0
Reputation: 398
using lib react-native-biometrics support touchid & faceid for Android
Upvotes: -1
Reputation: 18538
Refer to this answer
react-native-touch-id should work for both TouchID and FaceID.
Refer to this documentation
This package requires a compiled SDK version of 29 (Android 10.0) or higher
this might be indicate that it will work only on android 10 or higher.
Upvotes: 0
Reputation: 3773
My straight answer would be NO. The justification for that is because Android has never shipped FaceID/Face unlock from its own in the Stock version or core API. The Face ID/Face unlock solutions we get in android are from vendors which they have indulged in android on top of the core APIs as third-party integration and I assume no one can write an interface on top of hundreds of different implementations to support such feature from a single API.
Upvotes: 1
Reputation: 59
I think this is because Face-Id and Touch-Id are iOS only. and you still seem to get Touch-Id working as Biometrics on android defaults to what you are using for your lock screen (sometimes it also depends on your device manufacturer) I got this info from here
Upvotes: 3