1
0
mirror of https://github.com/bitwarden/mobile.git synced 2024-11-27 12:26:31 +01:00

FingerprintManager to detect fingerprints on SDK 28

This commit is contained in:
Kyle Spearrin 2019-10-23 11:26:00 -04:00
parent 5f0c9725ce
commit b13f5356fe

View File

@ -9,6 +9,7 @@ using Android.App.Assist;
using Android.Content;
using Android.Content.PM;
using Android.Hardware.Biometrics;
using Android.Hardware.Fingerprints;
using Android.Nfc;
using Android.OS;
using Android.Provider;
@ -350,12 +351,17 @@ namespace Bit.Droid.Services
public async Task<bool> BiometricAvailableAsync()
{
if(UseNativeBiometric())
var activity = (MainActivity)CrossCurrentActivity.Current.Activity;
if((int)Build.VERSION.SdkInt >= 29)
{
var activity = (MainActivity)CrossCurrentActivity.Current.Activity;
var manager = activity.GetSystemService(Context.BiometricService) as BiometricManager;
return manager.CanAuthenticate() == BiometricCode.Success;
}
else if((int)Build.VERSION.SdkInt == 28)
{
var manager = activity.GetSystemService(Context.FingerprintService) as FingerprintManager;
return manager.IsHardwareDetected && manager.HasEnrolledFingerprints;
}
else
{
try