> For the complete documentation index, see [llms.txt](https://doc.ozforensics.com/oz-knowledge/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://doc.ozforensics.com/oz-knowledge/guides/developer-guide/sdk/oz-mobile-sdk/android/customizing-android-sdk.md).

# Customizing Android SDK

## Configuration

We recommend applying these settings when starting the app.

{% tabs %}
{% tab title="Kotlin" %}

```kotlin
// 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 
```

{% endtab %}

{% tab title="Java" %}

```java
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); 
```

{% endtab %}
{% endtabs %}

## 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.

{% tabs %}
{% tab title="Kotlin" %}

```kotlin
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
    )
}
```

{% endtab %}

{% tab title="Java" %}

```java
OzLivenessSDK.config.setCustomization(new UICustomization(
    // customization parameters for the toolbar
    new ToolbarCustomization(
        R.drawable.ic_close,                        // closeButtonIcon
        new Color.ColorRes(R.color.white),          // closeButtonColor
        "Liveness",                                 // titleText
        R.font.roboto,                              // titleFont
        18,                                         // titleSize (sp)
        null,                                       // titleFontStyle
        new Color.ColorRes(R.color.white),          // titleColor
        100,                                        // titleAlpha (%)
        true,                                       // isTitleCentered
        null,                                       // titleStyle
        new Color.ColorRes(R.color.black),          // backgroundColor
        60                                          // backgroundAlpha (%)
    ),
    // customization parameters for the center hint
    new CenterHintCustomization(
        R.font.roboto,                              // textFont
        null,                                       // textFontStyle
        new Color.ColorRes(R.color.white),          // textColor
        20,                                         // textSize (sp)
        null,                                       // verticalPosition
        R.style.Sdk_Text_Primary,                   // textStyle
        new Color.ColorRes(R.color.black),          // backgroundColor
        56,                                         // backgroundOpacity (%)
        14,                                         // backgroundCornerRadius (dp)
        100                                         // textAlpha (%)
    ),
    // customization parameters for the hint animation
    new HintAnimation(
        new Color.ColorRes(R.color.error_red),      // hintGradientColor
        80,                                         // hintGradientOpacity (%)
        120,                                        // animationIconSize
        false                                       // hideAnimation
    ),
    // customization parameters for the frame around the user face
    new FaceFrameCustomization(
        new GeometryType.Rectangle(10),             // geometryType, 10 = corner radius
        5,                                          // strokeWidth (dp)
        new Color.ColorRes(R.color.error_red),      // strokeFaceNotAlignedColor
        new Color.ColorRes(R.color.success_green),  // strokeFaceAlignedColor
        100,                                        // strokeAlpha (%)
        50,                                         // verticalPosition (%)
        3                                           // strokePadding (dp)
    ),
    // customization parameters for the SDK version label
    new VersionLabelCustomization(
        R.font.roboto,                              // textFont
        12,                                         // textSize (sp)
        null,                                       // textFontStyle
        new Color.ColorRes(R.color.white),          // textColor
        100,                                        // textAlpha (%)
        R.style.Sdk_Text_Primary                    // textStyle
    ),
    // customization parameters for the background outside the frame
    new BackgroundCustomization(
        new Color.ColorRes(R.color.black),          // backgroundColor
        60                                          // backgroundAlpha (%)
    ),
    // hides the status bar and the navigation buttons
    true,                                           // hideStatusBar
    null,                                           // dialogStyle
    // customization parameters for the antiscam protection text
    new AntiScamCustomization(
        "Recording...",                             // textMessage
        R.font.roboto,                              // textFont
        14,                                         // textSize
        new Color.ColorRes(R.color.white),          // textColor
        100,                                        // textAlpha (%)
        R.style.Sdk_Text_Primary,                   // textStyle
        new Color.ColorRes(R.color.black),          // backgroundColor
        100,                                        // backgroundOpacity (%)
        20,                                         // cornerRadius
        new Color.ColorRes(R.color.success_green)   // flashColor
    ),
    // custom logo parameters (must be allowed by the license)
    new LogoCustomization(
        new Image.Drawable(R.drawable.ic_logo),     // image
        new Size(176, 64),                          // size (dp)
        100,                                        // verticalPosition
        50                                          // horizontalPosition
    )
));
```

{% endtab %}
{% endtabs %}

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

{% tabs %}
{% tab title="Kotlin" %}

```kotlin
OzLivenessSDK.config.localizationCode = OzLocalizationCode.EN
```

{% endtab %}

{% tab title="Java" %}

```java
OzLivenessSDK.config.setLocalizationCode(OzLocalizationCode.EN)
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://doc.ozforensics.com/oz-knowledge/guides/developer-guide/sdk/oz-mobile-sdk/android/customizing-android-sdk.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
