Skip to content

Instantly share code, notes, and snippets.

@LucioMSP
Created November 8, 2019 19:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save LucioMSP/f1c7d56def83c89cd765b1b157260aa8 to your computer and use it in GitHub Desktop.
Save LucioMSP/f1c7d56def83c89cd765b1b157260aa8 to your computer and use it in GitHub Desktop.
Ejemplo de cómo implementar la autenticación biométrica en aplicaciones Xamarin.Forms
using System;
using Xamarin.Forms;
using Plugin.Fingerprint;
using System.ComponentModel;
namespace FingerPrintPCL
{
[DesignTimeVisible(false)]
public partial class MainPage : ContentPage
{
public MainPage()
{
InitializeComponent();
}
private async void btnFinger(object sender, EventArgs e)
{
var result = await CrossFingerprint.Current.IsAvailableAsync(true);
if (result)
{
var auth = await CrossFingerprint.Current.AuthenticateAsync("Toca el Sensor");
if (auth.Authenticated)
{
Resultado.Text = "¡Autenticado!";
}
else
{
Resultado.Text = "Huella digital no reconocida.";
}
}
else
{
await DisplayAlert("Oops", "Dispositivo no compatible.", "OK");
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment