Try it free

Configure Session Replay for Android

  • Latest Dynatrace
  • How-to guide
  • 7-min read
  • Published May 21, 2026
  • Preview

Preview

This page describes how to activate and customize Session Replay for your Android apps.

Use Session Replay

Session Replay on Android allows you to capture your customers' interactions with your mobile application and replay each tap, swipe, and screen rotation in a movie-like experience.

Use Session Replay on crashes

You can also use it to get more context for crash analysis in the form of video-like screen recordings that replay the user actions preceding a detected crash.

Prerequisites

Make sure that your system meets the following requirements:

  • Dynatrace version 1.303.
  • OneAgent for Android version 8.303.
  • Real User Monitoring activated for your application.
  • Active Dynatrace Digital Experience Monitoring license.

Supported technologies and known limitations

  • Android 5.0+ (API level 21+) is supported.
  • Android Gradle plugin 7.0+ is supported.
  • Kotlin version 1.9+ is supported.
    • Kotlin version 1.8 is supported for Kotlin compatibility.
  • Jetpack Compose version 1.4+ is supported starting with OneAgent for Android version 8.325.
  • Session Replay is not available for cross-platform frameworks such as Cordova, React Native, Flutter, Xamarin, and similar.
  • For a hybrid app, Session Replay is supported only for the native part of the app. Session Replay is not supported for the browser part of a hybrid app.
  • Only AndroidX support libraries are supported. Classes such as Activity or Fragment in com.android.support are not supported.
  • We recommend not using other crash reporting tools together with Dynatrace Session Replay.
  • Session Replay can capture only certain events. However, if you need to track a specific view or event that is not supported by default, you can capture a custom event.
  • You can only play back the user sessions recorded with Session Replay in certain browsers.

Session Replay is a video-like reconstruction of the user interaction with mobile application, that uses captured events and data. Because of this approach, a replayed session can differ from the actual user experience. Known issues:

  • Fragments with in-out animations can cause problems, especially when animations are short.
  • Floating action buttons can cause data masking issues.
  • The inputType attribute within the Button component might result in buttons appearing without text when captured.

Activate Session Replay on Android and adjust number of recorded sessions

If you haven't done so already, complete all steps described in the initial setup for Android frontends.

  1. Go to Experience Vitals Experience Vitals > Overview.
  2. Select Mobile to view all mobile frontends.
  3. Select the frontend you want to configure.
  4. Switch to the Settings tab.
  5. Under Enablement and cost control:
    1. Turn on Real User Monitoring Classic or both Real User Monitoring Classic and Real User Monitoring.
    2. Select Session Replay Classic or both Session Replay Classic and Session Replay, and then enter the new Capture rate of session replay value:
      • 100 percent to capture all sessions.
      • Lower than 100 percent to capture randomly selected sessions.
    3. To capture all sessions with a crash regardless of the capture rate, select Session Replay for crashes Classic or both Session Replay for crashes Classic and Session Replay for crashes.
  6. From the application settings, select Instrumentation wizard, and then select Android.
  7. Follow the steps in the instrumentation wizard.

For Android Gradle plugin versions 4.0 and 4.1, you need to change the compile option to Java 8. This can be done during the instrumentation wizard step called Apply the Dynatrace plugin and add the plugin configuration. Add the following code to the top-level build file:

compileOptions {
sourceCompatibility 1.8
targetCompatibility 1.8
}

For Android Gradle plugin 4.2+, Java 8 is used by default, so no configuration change is needed.

Mask sensitive data

Data masking levels

Session Replay comes with three predefined masking levels:

  • Safest—all the editable text fields, images, labels, web views, and switches are masked.
  • Safe—all the editable text fields are masked.
  • Custom—by default, masks the same elements as Safest, but you can decide exactly which application components or views should be masked. See Configure custom masking for details.

Change masking level

By default, OneAgent applies the Safest masking level. To change it to the Safe or Custom level, use the API to configure OneAgent. If you've opted for the Custom level, see Configure custom masking for details on how to set which application components or views should be masked.

Example 1: Change masking level to Safe

Use the following code to set the masking level to Safe.

MaskingConfiguration config = new MaskingConfiguration.Safe();
// .Safest or .Custom
DynatraceSessionReplay.setConfiguration(Configuration.builder()
.withMaskingConfiguration(config)
.build());

Example 2: Change masking level to Custom

Use the following code to set the masking level to Custom. For additional options, see Configure custom masking.

MaskingConfiguration config = new MaskingConfiguration.Custom();
// .Safest or .Safe
DynatraceSessionReplay.setConfiguration(Configuration.builder()
.withMaskingConfiguration(config)
.build());

Example 3: Change masking level to Custom and remove all masked views

Use the following code to set the masking level to Custom and remove all masked views (removeAllMaskedViews). For additional options, see Configure custom masking.

MaskingConfiguration config = new MaskingConfiguration.Custom().removeAllMaskedViews();
DynatraceSessionReplay.setConfiguration(Configuration.builder()
.withMaskingConfiguration(config)
.build());

Configure custom masking

If you set the data masking level to Custom, you can use additional API methods to decide which application components or views should be masked. You can:

  • Mask views.
  • Mask views using android:tag.
  • Mask views using a masking tag.
  • Mask Jetpack Compose composables.

Mask views

You can activate or deactivate masking globally or for the selected components, such as text fields, images, labels, web views, and switches.

Set<Class<? extends View>> set = new HashSet<Class<? extends View>>() {
add(ImageView.class);
add(WebView.class);
};
new MaskingConfiguration.Custom().addMaskedView(ImageView.class); // Adds one masked view
new MaskingConfiguration.Custom().addMaskedViews(set); // Adds all masked views
new MaskingConfiguration.Custom().removeMaskedView(ImageView.class); // Removes one masked view
new MaskingConfiguration.Custom().removeAllMaskedViews(); // Removes all masked views

You need to apply the custom masking configuration for it to take effect. See Change masking level to Custom and remove all masked views for the example code snippet.

Mask views using android:tag

You can also activate or deactivate masking of the selected views based on their android:tag.

Set<Integer> set = new HashSet<Integer>() {
add(R.id.view_id1);
add(R.id.view_id2);
};
new MaskingConfiguration.Custom().addMaskedIds(set);
new MaskingConfiguration.Custom().addNonMaskedIds(set);
new MaskingConfiguration.Custom().removeMaskedIds(set);
new MaskingConfiguration.Custom().removeNonMaskedIds(set);

You need to apply the custom masking configuration for it to take effect. See Change masking level to Custom and remove all masked views for the example code snippet.

Mask views using a masking tag

You can also mask a view by adding the data-dtrum-mask masking tag to the view's android:tag. A view with this masking tag is always masked.

Mask Jetpack Compose composables

Jetpack Compose provides manual masking functionality that allows you to control which composables are masked in Session Replay. To mask a composable, use the dtMask modifier.

import com.dynatrace.agent.compose.api.dtMask
@Composable
fun MyScreen() {
Column {
Text(
text = "This text will be masked",
modifier = Modifier.dtMask()
)
}
}

Activate Session Replay logs

You can activate Session Replay logs the same way as for OneAgent. For details, see Enable debug logging for Dynatrace Android Gradle plugin or OneAgent SDK.

Capture custom events

Session Replay records only certain events. However, you can track an event that is not supported by default.

DynatraceSessionReplay.trackCustomEvent("User logged")

Change transmission mode to Wi-Fi for images

By default, all data—information on captured events and images—is sent over any connection. However, you can opt to transfer images only when the users are connected to Wi-Fi to save their mobile data.

DynatraceSessionReplay.setConfiguration(
Configuration.builder()
.withDataTransmissionMode(DataTransmissionMode.NOT_METERED_NETWORK)
.build()
)

Troubleshooting

  • User sessions are not recorded at all
  • User sessions are recorded, but Session Replay is not available

Related topics

  • Session Replay
Related tags
Digital Experience