mirror of
https://github.com/bitwarden/android.git
synced 2024-10-31 23:25:45 +03:00
FingerprintManager to detect fingerprints on SDK 28
This commit is contained in:
parent
5f0c9725ce
commit
b13f5356fe
1 changed files with 8 additions and 2 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue