-
-
Save vinodbaste/bb37b1ca47fd5a353e1a1e65a981adc3 to your computer and use it in GitHub Desktop.
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
fun showBiometricPrompt( | |
title: String = "Biometric Authentication", | |
subtitle: String = "Enter biometric credentials to proceed.", | |
description: String = "Input your Fingerprint or FaceID to ensure it's you!", | |
activity: AppCompatActivity, | |
listener: BiometricAuthListener, | |
cryptoObject: BiometricPrompt.CryptoObject? = null, | |
allowDeviceCredential: Boolean = false | |
) { | |
// 1 | |
val promptInfo = setBiometricPromptInfo( | |
title, | |
subtitle, | |
description, | |
allowDeviceCredential | |
) | |
// 2 | |
val biometricPrompt = initBiometricPrompt(activity, listener) | |
// 3 | |
biometricPrompt.apply { | |
if (CryptoObject == null) authenticate(promptInfo) | |
else authenticate(promptInfo, cryptoObject) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment