Created
November 8, 2019 19:06
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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