// Пример использования нового API для авторизации по биометрии
class AuthenticationSampleActivity : FragmentActivity() {
private val authResultLauncher = registerForAuthenticationResult(
onAuthFailedCallback = {
Log.i(TAG, "onAuthenticationFailed, try again")
},
resultCallback = { result: AuthenticationResult ->
when(result) {
is AuthenticationResult.Success -> result.authType
is AuthenticationResult.Error -> result.errorCode
}
}
)
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
val authRequest: AuthenticationRequest =
AuthenticationRequest.Biometric.Builder(...)
// Setup build request
.build()
authResultLauncher.launch(authRequest)
}
}
Post #8869
7.02K
- 👍 21