smstuebe / xamarin-fingerprint

Xamarin and MvvMCross plugin for authenticate a user via fingerprint sensor
Microsoft Public License
490 stars 115 forks source link

Fingerprint alert dismisses with "TooManyAttempts" status after some time on Samsung tablet #62

Closed alekseyz closed 2 years ago

alekseyz commented 7 years ago

Issue happens only on Samsung devices. If start fingerprint authentication process (call CrossFingerprint.Current.AuthenticateAsync()) and leave it for 2-3 minutes with no interaction dialog will be closed with failed result with 'TooManyAttempts' status automatically.

Steps to reproduce

  1. Launch project

  2. Call CrossFingerprint.Current.AuthenticateAsync(authRequestConfig);

  3. Wait

Expected behavior

Dialog will be shown until user try to authenticate with fingerprint close it.

Actual behavior

Dialog automatically closes after 2-3 minutes.

Configuration

Version of the Plugin: 1.4.3

Platform: Android 6.0

Device: Samsung Galaxy Tab

Code:

AuthenticationRequestConfiguration authRequestConfig = new AuthenticationRequestConfiguration(message);
authRequestConfig.FallbackTitle = fallbackButtonText;
authRequestConfig.CancelTitle = cancelButtonText;
FingerprintAuthenticationResult authenticationResult = await CrossFingerprint.Current.AuthenticateAsync(authRequestConfig);

Research notes

After some researches I find out that it happens every 3 mins. I found function in source code that could cause this behavior:

private async Task<bool> StartIdentify(SpassFingerprint.IIdentifyListener listener)
{
    // TODO: remove retry and delay, if samsung fixes the library 
    for (var i = 0; i < 5; i++)
    {
        try
        {
            _spassFingerprint.StartIdentify(listener);
            return true;
        }
        catch (IllegalStateException ex)
        {
            Log.Warn(nameof(SamsungFingerprintImplementation), ex);
            await Task.Delay(100);
        }
        catch (Exception ex)
        {
            Log.Warn(nameof(SamsungFingerprintImplementation), ex);
            return false;
        }
    }

    return false;
}

Could you tell purpose of this function. Does library still not fixed ?

smsissuechecker commented 7 years ago

Hi @alekseyz,

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.