0
0
Android Kotlinmobile~20 mins

Biometric authentication in Android Kotlin - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Biometric Authentication Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
ui_behavior
intermediate
1:30remaining
What happens when biometric authentication succeeds?
In an Android app using BiometricPrompt, what is the typical behavior after the user successfully authenticates with fingerprint or face?
AThe app proceeds to the secured content or action immediately.
BThe app closes automatically without any message.
CThe app shows an error message and asks to try again.
DThe app restarts the authentication prompt endlessly.
Attempts:
2 left
💡 Hint
Think about what the app wants to do after confirming the user is authorized.
📝 Syntax
intermediate
2:00remaining
Identify the correct way to create a BiometricPrompt.PromptInfo
Which Kotlin code snippet correctly creates a BiometricPrompt.PromptInfo with title "Login" and negative button text "Cancel"?
A
val promptInfo = BiometricPrompt.PromptInfo.Builder()
  .setTitle("Login")
  .setNegativeButtonText("Cancel")
  .build()
B
val promptInfo = BiometricPrompt.PromptInfo()
  .setTitle("Login")
  .setNegativeButtonText("Cancel")
  .build()
C
val promptInfo = BiometricPrompt.PromptInfo.Builder
  .setTitle("Login")
  .setNegativeButtonText("Cancel")
  .build()
D
val promptInfo = BiometricPrompt.PromptInfo.Builder()
  .title("Login")
  .negativeButtonText("Cancel")
  .build()
Attempts:
2 left
💡 Hint
Remember to call Builder() as a function and use the correct setter methods.
lifecycle
advanced
2:00remaining
When should you invalidate the BiometricPrompt callback?
In an Android app using BiometricPrompt, when is the best time to invalidate or cancel the biometric authentication callback to avoid memory leaks?
ARight after calling authenticate() method.
BOnly when the user cancels the authentication manually.
CIn the onDestroy() lifecycle method of the Activity or Fragment.
DNever, the system handles it automatically.
Attempts:
2 left
💡 Hint
Think about cleaning up resources when the UI component is no longer visible.
🧠 Conceptual
advanced
2:00remaining
Why use BiometricPrompt over FingerprintManager?
Why is it recommended to use BiometricPrompt API instead of the older FingerprintManager API in Android apps?
ABiometricPrompt requires no permissions, while FingerprintManager does.
BBiometricPrompt supports multiple biometric types like face and iris, not just fingerprint.
CFingerprintManager is faster and more secure than BiometricPrompt.
DFingerprintManager works on all Android versions, BiometricPrompt only on the latest.
Attempts:
2 left
💡 Hint
Consider the types of biometric authentication supported.
🔧 Debug
expert
2:30remaining
What error occurs if you call authenticate() without setting PromptInfo?
Given this Kotlin code snippet: val biometricPrompt = BiometricPrompt(this, executor, callback) biometricPrompt.authenticate() What error will this cause at runtime?
ASecurityException because permissions are missing.
BNullPointerException because callback is null.
CNo error, authentication starts with default settings.
DIllegalArgumentException because PromptInfo is missing.
Attempts:
2 left
💡 Hint
Check the required parameters for authenticate() method.