Declare the Datadog Session Replay as a dependency:
build.gradle
implementation("com.datadoghq:dd-sdk-android-rum:[datadog_version]")implementation("com.datadoghq:dd-sdk-android-session-replay:[datadog_version]")// in case you need material support
implementation("com.datadoghq:dd-sdk-android-session-replay-material:[datadog_version]")
Enable Session Replay in your app:
Application.kt
valsessionReplayConfig=SessionReplayConfiguration.Builder([sampleRate])// in case you need material extension support
.addExtensionSupport(MaterialExtensionSupport()).build()SessionReplay.enable(sessionReplayConfig)
Set the sample rate for recorded sessions to appear
Sample rate is a required parameter in Session Replay configuration. It must be a number between 0.0 and 100.0, where 0 means no replays will be recorded and 100 means all RUM sessions will contain replay.
This sample rate is applied in addition to the RUM sample rate. For example, if RUM uses a sample rate of 80% and Session Replay uses a sample rate of 20%, it means that out of all user sessions, 80% will be included in RUM, and within those sessions, only 20% will have replays.