-
Notifications
You must be signed in to change notification settings - Fork 27.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[local_auth] canCheckBiometrics
returns false when Face ID permission isn't granted
#160083
[local_auth] canCheckBiometrics
returns false when Face ID permission isn't granted
#160083
Comments
Hi @MohsinIkram-Auxilium, Thanks for filing the issue. I believe you should use Future<void> _getAvailableBiometrics() async {
late List<BiometricType> availableBiometrics;
try {
availableBiometrics = await auth.getAvailableBiometrics();
} on PlatformException catch (e) {
availableBiometrics = <BiometricType>[];
print(e);
}
if (!mounted) {
return;
}
setState(() {
_availableBiometrics = availableBiometrics;
});
} |
Incase that doesn't work this could be the reason #117309 |
@maheshj01 when user not enable the Face ID then the getAvailableBiometrics list always empty. I have added different checks like I need to add check at the very top of these like User enabled the Face ID permission or not, if not then simply i would show error message to user please go to setting and enable Face ID. Thats it. It would be better if package developers team can add Face ID check permission. So it would be for us to show appropriate error message. |
I believe you should be able to detect this once the referred issue has been solved. But I agree there should be a way to detect which biometrics are enabled something like getAvailableBiometrics gives a list of enrolled biometrics but does not guarantee that the biometrics is enabled by user on device. Labeling this issue as a proposal to provide an api to determine if a particular biometric is enrolled and enabled to authenticate. |
Sorry I think you didn't get my point. I have a simple question. Let me clarify again. Lets suppose I have enrolled face and finger auth in the mobile. So now I disable the FaceID and trying to call again auth method. Now there is no way to check user disable the FaceID. Thats it. |
@maheshj01 any update on my feedback please? |
@MohsinIkram-Auxilium, I have marked this issue as a proposal to have some way to know which biometric is enabled/disabled. If there are any further updates on this issue you will see them here. |
Thanks @maheshj01. |
I was faced with unpredictable behavior. Sometimes the canCheckBiometrics method returns "false" even when everything is enabled and configured. And for some reason, after some time it returns "true" again |
This is a bug; Someone will need to see what error is returned in this code when the permission isn't granted, and we can special-case it. |
canCheckBiometrics
returns false when Face ID permission isn't granted
Yeah @stuartmorgan. You are right. |
I enabled FaceID in my phone settings. Then I ran the example app. When I selected "Authenticate" in the app I denied permission. Then I checked biometrics, and it returned -6 so However, a better way to detect the permission denied case might be if |
Use case
I mistakenly disable the Face ID permission to my app. Now I'm unable to know how can i ask to the user you disable the permission. Basically I'm showing the Face Icon on these methods.
isDeviceSupported
this is gives me true butcanCheckBiometrics
this always give me false when I'm not enable the Face ID. So i just need to know how can i check if the user disbale the Face ID. so I asked him to go to setting and enable it.Need urgent help on this.
Thanks
Proposal
The text was updated successfully, but these errors were encountered: