Copy as Markdown[Open in ChatGPT](https://chatgpt.com/?q=Read%20https%3A%2F%2Fdocs-docusaurus.kinsta.page%2Fuser-guides%2Frum%2Fproduct-features%2Fsession-replay%2Fandroid.md%20and%20help%20me%20with%20my%20question%20about%20this%20Coralogix%20documentation%20page.)[Open in Claude](https://claude.ai/new?q=Read%20https%3A%2F%2Fdocs-docusaurus.kinsta.page%2Fuser-guides%2Frum%2Fproduct-features%2Fsession-replay%2Fandroid.md%20and%20help%20me%20with%20my%20question%20about%20this%20Coralogix%20documentation%20page.)

# Enable session replay on Android

## Overview[​](#overview "Direct link to Overview")

Follow this guide to enable Session Replay for [Real User Monitoring (RUM)](https://docs-docusaurus.kinsta.page/user-guides/rum/getting-started/real-user-monitoring/.md) in your Android app.

[Session Replay](https://docs-docusaurus.kinsta.page/user-guides/rum/product-features/session-replay/.md) captures a visual sequence of user interactions in your app by recording periodic screenshots. This allows you to analyze what the user saw before, during, and after an issue — helping you quickly pinpoint the source of errors, performance slowdowns, or unexpected behavior. Use Session Replay to recreate the user experience and better understand the context behind each session.

## Prerequisites[​](#prerequisites "Direct link to Prerequisites")

Before enabling Session Replay, you must install and initialize the [Coralogix Android RUM SDK](https://docs-docusaurus.kinsta.page/user-guides/rum/sdk-installation/android/.md) in your app.

Note

The Session Replay feature extends the Android RUM SDK and must be initialized **after** the base SDK setup. Attempting to initialize Session Replay without the base SDK will result in an initialization error.

## Session Replay by default[​](#session-replay-by-default "Direct link to Session Replay by default")

Session Replay on Android:

* Evaluates UI one frame per second (FPS) and captures only if the layout changed since the previous screenshot.
* Masks all text inputs (when `maskAllTexts` is enabled).
* Redacts sensitive input field types (passwords, emails, numbers, etc.) if specified.
* Samples 100% of sessions by default.

You can customize these defaults using the configuration options below.

## Configure and initialize[​](#configure-and-initialize "Direct link to Configure and initialize")

Use the `SessionReplayOptions` class to configure capture behavior, privacy masking, and sampling.

### Example[​](#example "Direct link to Example")

```
import android.app.Application

import com.coralogix.android.sdk.session_replay.SessionReplay

import com.coralogix.android.sdk.session_replay.model.SessionReplayOptions

import com.coralogix.android.sdk.internal.infrastructure.display.enums.EditTextType



class MyApp : Application() {

    override fun onCreate() {

        super.onCreate()

        val options = SessionReplayOptions(

            captureScale = 0.5f, // Scale screenshots to half resolution

            captureCompressQuality = 0.8f, // Compress images for size optimization

            sessionRecordingSampleRate = 80, // Capture 80% of sessions

            autoStartSessionRecording = true, // Start recording automatically

            maskAllTexts = false, // Do not mask all text by default

            maskInputFieldsOfTypes = listOf(

                EditTextType.PASSWORD,

                EditTextType.EMAIL

            )

        )

        SessionReplay.initialize(this, options)

    }

}
```

## Options reference[​](#options-reference "Direct link to Options reference")

Configuration fields for `SessionReplayOptions`:

| Option                       | Type                 | Description                                                                            | Default       |
| ---------------------------- | -------------------- | -------------------------------------------------------------------------------------- | ------------- |
| `autoStartSessionRecording`  | `Boolean`            | Start recording automatically                                                          | `true`        |
| `captureScale`               | `Float`              | Screenshot resolution scale factor (0–1). Lower values reduce size and memory usage    | `0.5f`        |
| `captureCompressQuality`     | `Float`              | Image compression (0–1). Lower values reduce fidelity and file size                    | `1.0f`        |
| `sessionRecordingSampleRate` | `Int` (0–100)        | % of sessions to capture                                                               | `100`         |
| `maskAllTexts`               | `Boolean`            | Redact all on-screen text                                                              | `true`        |
| `maskInputFieldsOfTypes`     | `List<EditTextType>` | Redact only specific input fields (e.g., password, email, phone)                       | `emptyList()` |
| `maskAllImages`              | `Boolean`            | Mask all images in captured views                                                      | `false`       |
| `textsToMask`                | `List<String>`       | Text patterns to redact (supports regex). Applied when `maskAllTexts` is `false`       | `emptyList()` |
| `sampleFrameRatePerSecond`   | `Int`                | How frequently the SDK evaluates the layout for changes. Lower values reduce CPU usage | `1`           |

## Image capture triggers[​](#image-capture-triggers "Direct link to Image capture triggers")

Screenshots are captured during session replay in the following cases:

* User taps anywhere on the screen.
* User navigates between activities or fragments.
* Screen layout changes.
* Error or crash occurs.
* Manual screen capture event via [`SessionReplay.captureScreenshot()`](#manually-capture-screen).

Android Session Replay combines a 1 FPS layout-change sampling \*\*\*\*with **event-based captures** (click, error), so you still see key moments even if they occur between checks

## Start and stop recording[​](#start-and-stop-recording "Direct link to Start and stop recording")

If `autoStartSessionRecording` is `false`, you can manually control recording:

```
SessionReplay.startSessionRecording()

SessionReplay.stopSessionRecording()
```

## Manually capture screen[​](#manually-capture-screen "Direct link to Manually capture screen")

Use `captureScreenshot` to capture a specific moment in the session:

```
SessionReplay.captureScreenshot()
```

## Shut down Session Replay[​](#shut-down-session-replay "Direct link to Shut down Session Replay")

Stop the recorder and release its resources. After shutdown, calling `startSessionRecording()` again has no effect until you re-initialize.

```
SessionReplay.shutdown()
```

## Privacy and masking[​](#privacy-and-masking "Direct link to Privacy and masking")

Coralogix provides flexible masking options to help you meet privacy requirements:

* **Text masking**: Use `maskAllTexts` to redact all on-screen text, or selectively mask only input fields via `maskInputFieldsOfTypes`.
* **Input field masking**: Protect sensitive data such as passwords, emails, phone numbers, and credit card fields by specifying their `EditTextType`.
* **View masking**: You can programmatically mark a specific view as sensitive:

```
mySensitiveView.maskView()
```

This ensures that the view’s contents are blurred in session replays.

> **Tip:** Always verify your masking rules in staging before going live, especially for sensitive inputs like login screens and payment forms.
