locked
Using plugin.fingerprint causes system.nullreferenceexception RRS feed

  • Question

  • User63305 posted

    I can't figure out what is causing the issue. Has anyone had the same issues?

    Wednesday, August 22, 2018 3:44 PM

All replies

  • User260753 posted

    Can you be more specific? What code are you using? Perhaps showing the complete log would be good too

    Wednesday, August 22, 2018 4:14 PM
  • User63305 posted

    Here is the function: (it works fine for iOS)

    ` async void ConfigureFingerID() { var result = await CrossFingerprint.Current.IsAvailableAsync(true); if (result) { var fingerprintAuthenticationResult = await CrossFingerprint.Current.AuthenticateAsync("myGopher Authentication"); if (fingerprintAuthenticationResult.Authenticated) { //await DisplayAlert("Finger ID", "Yes", "OK"); CrossSettings.Current.AddOrUpdateValue("FingerID", true); await DisplayAlert("Touch/Face ID Successful", "Touch/Face ID is now setup with the currently logged in writing number and password. If your password changes, you will have to setup Touch/Face ID again.", "OK"); } else { await DisplayAlert("Authentication Failed", "Touch/Face ID authentication failed", "OK"); } } else { await DisplayAlert("Touch/Face ID", "Touch/Face ID not available, make sure Touch/Face ID is setup on the device correctly.", "OK"); }
    ``

    Wednesday, August 22, 2018 4:16 PM
  • User357960 posted

    Hi TracyBarnes - Did you ever find a solution to your issue? I'm experiencing the same problem and would appreciate any solution you may have. Thanks!

    Monday, September 10, 2018 10:04 PM
  • User357960 posted

    I believe it found the solution to the issue. The MainActivity in the Android project was missing the following line:

    CrossCurrentActivity.Current.Init(this, bundle);

    Once that line was added, the exception was no longer raised and Fingerprint authentication started working.

    Tuesday, September 11, 2018 2:23 AM
  • User63305 posted

    Hi Brian,

    Yes, I found that to be the same issue for me.

    Tuesday, September 11, 2018 12:07 PM
  • User381619 posted

    @"BrianMiller.0349" said: I believe it found the solution to the issue. The MainActivity in the Android project was missing the following line:

    CrossCurrentActivity.Current.Init(this, bundle);

    Once that line was added, the exception was no longer raised and Fingerprint authentication started working.

    Working. Thank you

    Saturday, January 19, 2019 7:18 AM
  • User390023 posted

    Perfect, thanks! Watching this Xamarin University video "Fingerprint Scanning in Xamarin.Forms" they missed that layer so glad I found this post!!

    Friday, January 24, 2020 7:49 PM