FreakyAli / Plugin.Maui.Biometric

A biometric plugin for .NET MAUI
MIT License
80 stars 10 forks source link

How to protect an app after resume? #15

Open erossini opened 19 hours ago

erossini commented 19 hours ago

I'm using your control in my .NET 8 MAUI application. I like to know how to use it when the app is sent in the background and how to resume.

If I add in my App.xaml.cs_

protected override async void OnResume()
{
    base.OnResume();

    var isAvailable = await CrossFingerprint.Current.IsAvailableAsync(true);

    if (isAvailable)
    {
        var request = new AuthenticationRequestConfiguration("Login using biometrics", 
                                      "Confirm login with your biometrics");
        request.AllowAlternativeAuthentication = true;

        var result = await CrossFingerprint.Current.AuthenticateAsync(request);

        Console.Write(result);
    }
}

the application always shows the dialog for the authentication without allows the user to use the app. How can I ask the user to authenticate before continuing using the app?

Thank you in advance, Enrico

FreakyAli commented 13 hours ago

I am guessing you are not using this plugin