dotnet / android

.NET for Android provides open-source bindings of the Android SDK for use with .NET managed languages such as C#
MIT License
1.92k stars 526 forks source link

Add `setDeviceCredentialAllowed` to `BiometricPrompt.Builder` #4452

Closed haavamoa closed 4 years ago

haavamoa commented 4 years ago

I can not find the setDeviceCredentialAllowed method on BiometricPrompt.Builder in order to leverage falling back to pin-code / password / pattern. In the android developer docs it says that we should use that to fall back (doc). I also see that it is deprecated and SetAllowedAuthenticators will replace it. That might be why it's not added to Xamarin.Android yet?

Hope to see this added as we need a nice fallback for our users.

jpobst commented 4 years ago

It looks like setDeviceCredentialAllowed was only added in API-29, so unfortunately it's not going to be a great fallback. 😥

You will need to set your Compile using Android version: (Target Framework) to Android 10.0 (Q) and the method should be available. But you'll need to ensure you don't try to call it on earlier devices or it will crash.

https://docs.microsoft.com/en-us/xamarin/android/app-fundamentals/android-api-levels?tabs=windows#runtime-checks-for-android-versions