> For the complete documentation index, see [llms.txt](https://docs.luciq.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.luciq.ai/kmp/setup-luciq-for-kmp/setup-session-replay.md).

# Setup Session Replay

Record and replay user sessions from your KMP app. Covers enabling replay, what gets captured, capturing mode, screenshot quality, and upload control.

Session Replay records user sessions for replay in the Luciq dashboard. You can enable/disable it, control what is captured (network logs, Luciq logs, user steps), set capturing mode and screenshot quality, and control when replays are uploaded.

* [Support Tools Integration](/kmp/setup-luciq-for-kmp/setup-session-replay/support-tools-integration.md) – Using session replay with support tools

### Enable/disable

{% code title="Kotlin" %}

```kotlin
SessionReplayKmp.setEnabled(true)
```

{% endcode %}

### What is captured

{% code title="Kotlin" %}

```kotlin
SessionReplayKmp.setNetworkLogsEnabled(true)
SessionReplayKmp.setLuciqLogsEnabled(true)
SessionReplayKmp.setUserStepsEnabled(true)
```

{% endcode %}

### Session replay link

Get the link to the current session replay (e.g. to share with support):

{% code title="Kotlin" %}

```kotlin
scope.launch {
    SessionReplayKmp.getSessionReplayLink().collect { url ->
        url?.let { println(it) }
    }
}
```

{% endcode %}

### When to upload (sync predicate)

Upload only sessions that meet your criteria. The predicate receives `SessionMetadata` with fields such as: `appVersion`, `os`, `device`, `sessionDurationInSeconds`, `networkLogs`, `launchType`, `launchDuration`, `bugsCount`, `fatalCrashCount`, `oomCrashCount`, `hasLinkToAppReview`. Use them to decide whether to upload (e.g. only when there was a crash or bugs):

{% code title="Kotlin" %}

```kotlin
SessionReplayKmp.setSyncPredicate { metadata ->
    (metadata.fatalCrashCount ?: 0) > 0 || (metadata.bugsCount ?: 0) > 0
}
```

{% endcode %}

### Capturing mode

| Mode                         | Description                                                            |
| ---------------------------- | ---------------------------------------------------------------------- |
| `CapturingMode.Navigation`   | Screenshots when navigating between screens (default, lowest overhead) |
| `CapturingMode.Interactions` | Screenshots on navigation and user interactions                        |
| `CapturingMode.Frequency`    | Screenshots at a fixed interval (video-like) plus navigation           |

{% code title="Kotlin" %}

```kotlin
SessionReplayKmp.setCapturingMode(CapturingMode.Interactions)
```

{% endcode %}

Call before SDK init when possible.

### Screenshot quality

| Quality                       | Description                          |
| ----------------------------- | ------------------------------------ |
| `ScreenshotQuality.High`      | 50% WebP, best quality               |
| `ScreenshotQuality.Normal`    | 25% WebP, default                    |
| `ScreenshotQuality.Greyscale` | Grayscale + 25% WebP, most efficient |

{% code title="Kotlin" %}

```kotlin
SessionReplayKmp.setScreenshotQuality(ScreenshotQuality.Normal)
```

{% endcode %}

### Capture interval (frequency mode)

When using `CapturingMode.Frequency`, set the interval in milliseconds (min 500, default 1000):

{% code title="Kotlin" %}

```kotlin
SessionReplayKmp.setScreenshotCaptureInterval(intervalMs = 1000)
```

{% endcode %}


---

# 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://docs.luciq.ai/kmp/setup-luciq-for-kmp/setup-session-replay.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.
