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

Calling AuthenticateAsync on OnAppearing method doesn't wait for the fingerprint popup to appear

Open raviteja-sriram opened this issue 5 years ago • 10 comments

Steps to reproduce

  1. Try to setup Fingerprint auth on OnAppearing method of a page.

  2. Debug to see that it doesn't give the fingerprint popup on AuthenticateAsync method and returns false without awaiting

Note: I have used async on OnAppearing method, still it doesn't wait at AuthnticateAsync

Expected behavior

It should await on AuthenticateAsync and wait for user input and then proceed

Actual behavior

It doesn't wait on AuthenticateAsync and shows popup after the whole flow is over

Crashlog

No crash

Configuration

Version of the Plugin: 2.1.1

Platform: Android 9.0

Device: ASUS Zenfone max pro M2

raviteja-sriram avatar Jun 08 '20 08:06 raviteja-sriram

Hi @raviteja-sriram,

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 Jun 08 '20 08:06 smsissuechecker

I have the same issue. The ErrorMessage of AuthenticateAsync result says "FragmentManager is already executing transactions"

cbaumgartner avatar Jun 15 '20 11:06 cbaumgartner

FYI ; it worked well for me(Android 9.0/Android 10) maybe you haven't registered a fingerprint on the device (Settings->Security-> ... ) if this is the case nothing is displayed.

toumir avatar Jul 07 '20 14:07 toumir

I am testing the app on my device(not an emulator) and fingerprints are registered. And the same scenario works when I open fingerprint popup on a button click but not on OnAppearing method of a page.

Can you upload code snippet of your page, maybe I am missing something in my code.

raviteja-sriram avatar Jul 13 '20 11:07 raviteja-sriram

I am testing the app on my device(not an emulator) and fingerprints are registered. And the same scenario works when I open fingerprint popup on a button click but not on OnAppearing method of a page.

same here. It works fine after button click but not OnAppearing of a page.

cbaumgartner avatar Jul 13 '20 11:07 cbaumgartner

Not sure if it's the same issue, but I was experiencing something very similar. I solved it by calling the AuthenticateAsync method within a Device.BeginInvokeOnMainThread block.

After inspecting the ErrorMessage property on the authentication result, it said something related to needing to be called from the main thread.

yceron avatar Aug 05 '20 23:08 yceron

Not sure if it's the same issue, but I was experiencing something very similar. I solved it by calling the AuthenticateAsync method within a Device.BeginInvokeOnMainThread block.

After inspecting the ErrorMessage property on the authentication result, it said something related to needing to be called from the main thread.

Can you post the code snippet here for reference. Thanks in advance.

raviteja-sriram avatar Aug 06 '20 17:08 raviteja-sriram

I am having a similar issue on iOS when receiving a push notification, where the user pushes accept button. The app is supposed to start and require authentication for the accept to respond back. Unfortunately, AuthenticateAsync() does not prompt for authentication. It just returns back false, causing a decline to be sent back to the server.

When I have more time, I will download the source and trace the issue.

sandman202 avatar Sep 02 '20 15:09 sandman202

I have same issue as @cbaumgartner. After call of AuthenticateByFingerPrintAsync in OnPageAppearing Dialog for fingerprint is shown but not awaited. I get False in FingerAuthenticationResult and error message "FragmentManager is already executing transactions". I have latest version 2.1.2 of plugin. Tested on Sony Xperia XZ1 (Android 9), HUAWEI ANE-LX1 (Android 8)

filipleifer avatar Oct 19 '20 11:10 filipleifer

I can confirm that using this plugin like that: var result = await Device.InvokeOnMainThreadAsync(() => CrossFingerprint.Current.AuthenticateAsync(new("",""))) solves the issue :)

wstanczewski avatar Mar 09 '21 15:03 wstanczewski