Skip to content

Instantly share code, notes, and snippets.

@manicoder
Created February 25, 2018 07:47
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 manicoder/3c18456c79c81abb93c867215547fb9a to your computer and use it in GitHub Desktop.
Save manicoder/3c18456c79c81abb93c867215547fb9a to your computer and use it in GitHub Desktop.
using System;
using System.Collections.Generic;
using Plugin.Fingerprint;
using Xamarin.Forms;
namespace TouchIdSample
{
public partial class MainPage : ContentPage
{
public MainPage()
{
InitializeComponent();
}
void Handle_Clicked(object sender, System.EventArgs e)
{
FingerPrintLogin();
}
private async void FingerPrintLogin()
{
var result = await CrossFingerprint.Current.IsAvailableAsync();
if (result)
{
var FPCancellationToken = new System.Threading.CancellationToken();
var Auth = await CrossFingerprint.Current.AuthenticateAsync("Login for App", FPCancellationToken);
if (Auth.Authenticated)
{
this.Navigation.PushAsync(new SuccessPage());
}
else
{
await Application.Current.MainPage.DisplayAlert("", "Authentication fails", "Ok");
}
}
else
{
await Application.Current.MainPage.DisplayAlert("", "Finger print feature is not available in mobile...", "Ok");
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment