Skip to content

Instantly share code, notes, and snippets.

@isaidamier
Created November 26, 2019 02:48
Show Gist options
  • Save isaidamier/a6fce64b7fa720e44a218d9136b726e5 to your computer and use it in GitHub Desktop.
Save isaidamier/a6fce64b7fa720e44a218d9136b726e5 to your computer and use it in GitHub Desktop.
biometricOnClick
// Callback for the "authenticate" button in your app's UI.
override fun onClick(view: View) {
val promptInfo = createPromptInfo()
if (BiometricManager.from(context)
.canAuthenticate() == BiometricManager.BIOMETRIC_SUCCESS) {
biometricPrompt.authenticate(promptInfo, cryptoObject)
} else {
loginWithPassword()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment