fun verifyCredentialsOrShowSetupWarning(context: Context, prefList: List<Int>) { // Use the BiometricPrompt if available if (BiometricPromptFeature.canUseFeature(context)) { togglePrefsEnabled(prefList, false) biometricPromptFeature.get()?.requestAuthentication(unlockMessage()) return } // Fallback to prompting for password with the KeyguardManager val manager = context.getSystemService<KeyguardManager>() if (manager?.isKeyguardSecure == true) { showPinVerification(manager) } else { // Warn that the device has not been secured if (context.settings().shouldShowSecurityPinWarning) { showPinDialogWarning(context) } else { navigateOnSuccess() } } }
Use [BiometricPromptFeature] or [KeyguardManager] to confirm device security.