Start View
FaceLivenessDetector contains an initial (start) view with instructions and information about the Face Liveness check for the end user. By default, the start view is shown before the Face Liveness check. The start view can be disabled, allowing you to provide your own start view before FaceLivenessDetector is displayed in the app:
FaceLivenessDetector(
sessionId = <session ID>,
region = <region>,
disableStartView = true,
onComplete = {
Log.i("MyApp", "Face Liveness flow is complete")
},
onError = { error ->
Log.e("MyApp", "Error during Face Liveness flow", error)
}
)
Internationalization (I18n)
The text in FaceLivenessDetector is defined as string resources in the component's strings.xml file. These values can be translated/overwritten by following the instructions here.
Theming
FaceLivenessDetector supports Material3 theming, allowing you to theme FaceLivenessDetector to match the look and feel of your app. To theme FaceLivenessDetector according to your app's theme, wrap FaceLivenessDetector in your app's theme:
@Composable
fun MyTheme(
content: @Composable () -> Unit
) {
MaterialTheme(
// Override colorScheme with custom colors
colorScheme = LivenessColorScheme.default(),
// Override shapes with custom shapes
shapes = MaterialTheme.shapes,
// Override typography with custom typography
typography = MaterialTheme.typography,
content = content
)
}
MyTheme {
FaceLivenessDetector(...)
}
Amplify UI Face Liveness provides a Material3 color scheme for light mode and dark mode.
Light mode:
- primary
- onPrimary
- background
- onBackground
- surface
- onSurface
- error
- onError
- errorContainer
- onErrorContainer
Dark mode:
- primary
- onPrimary
- background
- onBackground
- surface
- onSurface
- error
- onError
- errorContainer
- onErrorContainer
To theme FaceLivenessDetector using the Amplify UI Face Liveness color scheme, wrap FaceLivenessDetector in a MaterialTheme and pass LivenessColorScheme
for the theme's color scheme:
MaterialTheme(
colorScheme = LivenessColorScheme.default()
) {
FaceLivenessDetector(...)
}
If no theme is provided, FaceLivenessDetector uses the default MaterialTheme values.
Best Practices
- The get ready screen has been optimized for increasing the end user's success rate and we strongly discourage making any changes to that screen.
- We do not recommend modifying the countdown time, face fit timeout, and oval size, as they affect the security and accuracy of the Face Liveness check.