For the complete documentation index, see llms.txt. This page is also available as Markdown.

Customizing Android SDK

Configuration

We recommend applying these settings when starting the app.

// connecting to the API server
OzLivenessSDK.setApiConnection(OzConnection.fromServiceToken(HOST, TOKEN))
// settings for the number of attempts to detect an action
OzLivenessSDK.config.attemptSettings = attemptSettings 
// the possibility to display additional debug information (you can do it by clicking the SDK version number)
OzLivenessSDK.config.allowDebugVisualization = allowDebugVisualization 
// logging settings
OzLivenessSDK.config.logging = ozLogging 
OzConfig config = OzLivenessSDK.config();
// connecting to the API server
OzLivenessSDK.setApiConnection(OzConnection.fromServiceToken(HOST, TOKEN));
// settings for the number of attempts to detect an action
config.setAttemptSettings(attemptSettings); 
// the possibility to display additional debug information (you can do it by clicking the SDK version number)
config.setAllowDebugVisualization(allowDebugVisualization); 
// logging settings
config.setLogging(ozLogging); 

Interface customization

To customize the Oz Liveness interface, use UIcustomization as shown below. For the description of customization parameters, please refer to Android SDK Methods and Properties.

OzLivenessSDK.config.customization = UICustomization().apply {
    // customization parameters for the toolbar
    toolbarCustomization.apply {
        closeButtonIcon = R.drawable.ic_close
        closeButtonColor = Color.ColorRes(R.color.white)
        titleText = "Liveness"
        titleFont = R.font.roboto
        titleSize = 18
        titleColor = Color.ColorRes(R.color.white)
        titleAlpha = 100
        isTitleCentered = true
        backgroundColor = Color.ColorRes(R.color.black)
        backgroundAlpha = 60
    }
    // customization parameters for the center hint
    centerHintCustomization.apply {
        textFont = R.font.roboto
        textColor = Color.ColorRes(R.color.white)
        textSize = 20
        textStyle = R.style.Sdk_Text_Primary
        backgroundColor = Color.ColorRes(R.color.black)
        backgroundOpacity = 56
        backgroundCornerRadius = 14
        textAlpha = 100
    }
    // customization parameters for the hint animation
    hintAnimation.apply {
        hintGradientColor = Color.ColorRes(R.color.error_red)
        hintGradientOpacity = 80
        animationIconSize = 120
        hideAnimation = false
    }
    // customization parameters for the frame around the user face
    faceFrameCustomization.apply {
        geometryType = GeometryType.Rectangle(10) // 10 is the corner radius
        strokeWidth = 5
        strokeFaceNotAlignedColor = Color.ColorRes(R.color.error_red)
        strokeFaceAlignedColor = Color.ColorRes(R.color.success_green)
        strokeAlpha = 100
        verticalPosition = 50
        strokePadding = 3
    }
    // customization parameters for the SDK version label
    versionLabelCustomization.apply {
        textFont = R.font.roboto
        textSize = 12
        textColor = Color.ColorRes(R.color.white)
        textAlpha = 100
    }
    // customization parameters for the background outside the frame
    backgroundCustomization.apply {
        backgroundColor = Color.ColorRes(R.color.black)
        backgroundAlpha = 60
    }
    // hides the status bar and the navigation buttons
    hideStatusBar = true
    // customization parameters for the antiscam protection text
    antiScamCustomization = AntiScamCustomization().apply {
        textMessage = "Recording..."
        textFont = R.font.roboto
        textSize = 14
        textColor = Color.ColorRes(R.color.white)
        textAlpha = 100
        backgroundColor = Color.ColorRes(R.color.black)
        backgroundOpacity = 100
        cornerRadius = 20
        flashColor = Color.ColorRes(R.color.success_green)
    }
    // custom logo parameters, all four are required
    // must be allowed by the license
    logoCustomization = LogoCustomization(
        Image.Drawable(R.drawable.ic_logo), // image
        Size(176, 64),                      // size (dp)
        100,                                // verticalPosition
        50,                                 // horizontalPosition
    )
}

By default, SDK uses the locale of the device. To switch the locale, use the code below:

Last updated

Was this helpful?