← Back to notebook index

Notebook Topic

Biometrics

English topic guide inspired by the original iOS Developer Notebook, expanded for both iOS and Android teams.

What this topic covers

Execution checklist

iOS implementation notes

Android implementation notes

Code examples

Swift

let context = LAContext()
var error: NSError?
if context.canEvaluatePolicy(.deviceOwnerAuthenticationWithBiometrics, error: &error) {
  context.evaluatePolicy(.deviceOwnerAuthenticationWithBiometrics,
                         localizedReason: "Unlock vault") { ok, _ in }
}

Kotlin

val prompt = BiometricPrompt(this, executor, callback)
val info = BiometricPrompt.PromptInfo.Builder()
  .setTitle("Unlock vault")
  .setAllowedAuthenticators(BIOMETRIC_STRONG or DEVICE_CREDENTIAL)
  .build()
prompt.authenticate(info)

Reference links

Related topics