xamarin-fingerprint icon indicating copy to clipboard operation
xamarin-fingerprint copied to clipboard

Fingerprint automatically cancels

Open bohdanhrybach opened this issue 4 years ago • 8 comments

Steps to reproduce

  1. Request AuthenticateAsync()

  2. Provide 5 times wrong fingerprint

  3. Wait 30 seconds

  4. Request AuthenticateAsync() once more

Expected behavior

Dialog is being shown and stayed till user provide fingerprint or cancel dialog.

Actual behavior

Dialog is being shown for short amount of time and then is closed automatically.

Crashlog

AuthenticationHandler.OnAuthenticationError() return code "5" and message "Fingerprint operation cancelled". I found that it can be because the sensor is occupied by a previous operation (https://stackoverflow.com/a/46277750).

It works fine when I cancel dialog:

await using (cancellationToken.Register(() => dialog.CancelAuthentication()))
{
                    dialog.Authenticate(info);

                    var result = await handler.GetTask();

                    if (!result.Authenticated)
                    {
                        // NOTE: release fingerprint
                        dialog.CancelAuthentication();
                    }

                    return result;
}

Configuration

Version of the Plugin: 2.1.1

Platform: Android 8.0.0

Device: Samsung S7 Edge

bohdanhrybach avatar May 04 '20 16:05 bohdanhrybach

Hi @bohdanhrybach,

I'm the friendly issue checker. Thanks for using the issue template :star2: I appreciate it very much. I'm sure, the maintainers of this repository will answer, soon.

smsissuechecker avatar May 04 '20 16:05 smsissuechecker

@smstuebe Maybe you can add me to contributors and I will create related PR?

bohdanhrybach avatar May 13 '20 09:05 bohdanhrybach

I have same issue. Any update?

Pelinalpp avatar Jun 23 '20 13:06 Pelinalpp

@Pelinalpp as I understand, no update :(

bohdanhrybach avatar Jun 23 '20 13:06 bohdanhrybach

@bohdanhrybach you said "It works fine when I cancel dialog". I cancel CancellationTokenSource but it doesn't work. Do I understand wrong?

Pelinalpp avatar Jun 23 '20 14:06 Pelinalpp

@Pelinalpp I assume that you just pass CancellationToken to AuthenticateAsync(token) and cancel it after get result, don't you? Sth like:

1) var tokenSource = new CancellationTokenSource();
2) var res = await AuthenticateAsync(tokenSource.Token);
3) tokenSource.Cancel();

But it will not work, changes is needed inside plugin. Because after we get result cancellation token disposes: https://github.com/smstuebe/xamarin-fingerprint/blob/0fc44bc84cf7a33d46f78fb34703c36d2e29a8ad/src/Plugin.Fingerprint/Platforms/Android/FingerprintImplementation.cs#L128 So cancelling CancellationTokenSource will not help.

bohdanhrybach avatar Jun 23 '20 14:06 bohdanhrybach

Yes I did this thank you.

Could you update for this issue please? @smstuebe

Pelinalpp avatar Jun 23 '20 14:06 Pelinalpp

@smstuebe The problem still exists. Could you please provide any updates about it?

DenisLaky avatar Mar 02 '21 14:03 DenisLaky