Skip to content

Instantly share code, notes, and snippets.

@Lavanyagaur22
Last active November 16, 2019 14:06
Show Gist options
  • Save Lavanyagaur22/7f332644bc3dd31f87608bfa5734a984 to your computer and use it in GitHub Desktop.
Save Lavanyagaur22/7f332644bc3dd31f87608bfa5734a984 to your computer and use it in GitHub Desktop.
val biometricPrompt = BiometricPrompt(activity, executor, object : BiometricPrompt.AuthenticationCallback() {
override fun onAuthenticationError(errorCode: Int, errString: CharSequence) {
super.onAuthenticationError(errorCode, errString)
if (errorCode == BiometricPrompt.ERROR_NEGATIVE_BUTTON) {
// user clicked negative/cancel button
} else {
TODO("Called when an unrecoverable error has been encountered and the operation is complete.")
}
}
override fun onAuthenticationSucceeded(result: BiometricPrompt.AuthenticationResult) {
super.onAuthenticationSucceeded(result)
runOnUiThread{
[email protected](Intent(activity,NextActivity::class.java))
}
}
override fun onAuthenticationFailed() {
super.onAuthenticationFailed()
runOnUiThread{
Toast.makeText(activity,"Authentication failed! Please try again.", Toast.LENGTH_SHORT).show()
}
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment