Configure data capture settings in a native Android app

You can customize how the Connect library captures data from your app. In native Android projects, these settings are stored in the ConnectLayoutConfig.json file in your app's assets/ directory.

Configuration file structure

The file has two top-level objects:

  • AutoLayout — screen-level capture settings.
  • AppendMapIds — maps existing element IDs to additional identifiers used in session replay.

At the top level of AutoLayout, use GlobalScreenSettings to set defaults for all screens. To override settings for a specific screen, add an object named after that screen (activity or fragment class name, or Compose screen name).

{
  "AutoLayout": {
    "GlobalScreenSettings": {
      "ScreenChange": true,
      "DisplayName": "",
      "CaptureLayoutDelay": 500,
      "ScreenShot": true,
      "NumberOfWebViews": 0,
      "CaptureUserEvents": true,
      "CaptureScreenVisits": true,
      "CaptureLayoutOn": 2,
      "CaptureScreenshotOn": 2,
      "Masking": {
        "HasMasking": true,
        "HasCustomMask": false,
        "MaskIdList": [],
        "MaskValueList": [],
        "MaskAccessibilityLabelList": [
          "sensitive_label",
          "mask_label"
        ]
      }
    },
    "LoginActivity": {
      "DisplayName": "Authorization",
      "CaptureLayoutDelay": 0,
      "NumberOfWebViews": 1,
      "CaptureScreenshotOn": 2
    }
  },
  "AppendMapIds": {
    "com.your.package:id/existingViewId": {
      "mid": "additionalId"
    }
  }
}

Configuration properties

Screen capture

PropertyValuesDescription
ScreenChangeBoolean. Default: true.Whether to capture this screen. Set to false to skip the screen entirely — no layout, screenshots, or events are captured. Use this for screens with sensitive information.
DisplayNameString. Default: "".A human-readable name for the screen shown in session replay. If empty, the class name is used.
CaptureLayoutDelayNumber (ms). Default: 500.How long the library waits before capturing the layout or taking a screenshot. Increase this for screens that take longer to render — if a screen appears blank in session replay, a longer delay usually fixes it.
CaptureLayoutOn0 — disabled. 1 — on first user gesture. 2 — on screen load (default).Controls when the library captures the screen layout.
CaptureScreenshotOn0 — disabled. 1 — on first user gesture. 2 — on screen load (default).Controls when the library takes a screenshot. If set to 0 and ScreenShot is true, screenshots are still captured on other user interaction and gesture events.
ScreenShotBoolean. Default: true.Whether to capture screenshots on screen load, user interactions, and gesture events.
CaptureUserEventsBoolean. Default: true.Whether to capture user interactions — taps, gestures, and form input. Set to false to pause capture on a specific screen.
CaptureScreenVisitsBoolean. Default: true.Whether to track screen load and unload events, showing how users navigate between screens. Has no effect when CaptureUserEvents is true.
NumberOfWebViewsNumber. Default: 0.The number of WebView objects on the screen. The library waits for all of them to finish loading before capturing the screen.

Masking

The Masking object controls PII protection for the screen. For full details, see Enable privacy protection in Android apps using the View system or Enable privacy protection in Android Compose apps.

AppendMapIds

Maps existing view resource IDs to additional identifiers shown in session replay. Use this to give more meaningful labels to views whose resource IDs are not descriptive.

"AppendMapIds": {
  "com.your.package:id/existingViewId": {
    "mid": "additionalId"
  }
}

How to set up the file

  1. Create ConnectLayoutConfig.json in app/src/main/assets/.
  2. Populate it using the template above or the sample file in the sample app.
  3. Customize the settings for your app.
  4. Run the file through a JSON validator before building.

Update settings programmatically

You can also update configuration values at runtime using Connect.updateConfig(). Call it after Connect.enable().

To update a single value:

Connect.updateConfig(
    key = "CaptureScreenVisits",
    value = "true",
    module = EOLifecycleObjectName.Tealeaf
)

To update multiple values at once, pass a JSONObject:

val config = JSONObject("""
    {
        "CaptureUserEvents": true,
        "CaptureScreenVisits": false
    }
""")
Connect.updateConfig(
    module = EOLifecycleObjectName.Tealeaf,
    configurationObject = config
)