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)
Enable Session Replay for your mobile application (see setup instructions above).
Additional configuration
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 are recorded and 100 means all RUM sessions 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% are included in RUM, and within those sessions, only 20% have replays.