AmplitudeSessionReplay integrates via plugin to your core analytics library.
Depending on the analytics library you use, you can use one of the following integrations to capture session replays.
- Install the dependencies
implementation("com.amplitude:plugin-session-replay-android:[0.11.1, 1.0.0]")
implementation("com.amplitude:analytics-android:[1.16.8, 2.0.0]")
- Initialize the SDK
// Initialize Amplitude Analytics SDK instance
val amplitude = Amplitude(Configuration(
apiKey = API_KEY,
context = applicationContext,
defaultTracking = DefaultTrackingOptions(sessions = true),
))
// Create and Install Session Replay Plugin
// Recording will be handled automatically
val sessionReplayPlugin = SessionReplayPlugin(sampleRate = 1.0)
amplitude.add(sessionReplayPlugin)
- Install the dependencies
implementation("com.amplitude:middleware-session-replay-android:[0.11.1, 1.0.0]")
implementation("com.amplitude:android-sdk:[2.40.1,3.0.0]")
- Initialize the SDK
val amplitude = Amplitude.getInstance()
.initialize(this, AMPLITUDE_API_KEY)
// Replay events will be flushed on close as well
// If setFlushEventsOnClose(false) you must call flush() manually
.setFlushEventsOnClose(true)
// Create Session Replay Middleware
val sessionReplayMiddleware = SessionReplayMiddleware(amplitude, sampleRate = 1.0)
// Add session replay middleware
// Recording will be handled automatically
amplitude.addEventMiddleware(sessionReplayMiddleware)
If you have any issues using our SDK, feel free to create a GitHub issue or submit a request on Amplitude Help.