Documentation Index
Fetch the complete documentation index at: https://launchdarkly-preview.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
This LaunchDarkly observability plugin is currently available in Early Access, and APIs are subject to change until a 1.x version is released.
Overview
This topic documents how to get started with the LaunchDarkly observability and session replay SDK for .NET MAUI. The .NET MAUI SDK supports observability for error monitoring and logging, and session replay for capturing UI snapshots. It provides cross-platform support for both Android and iOS through .NET MAUI’s native platform bindings.LaunchDarkly’s SDKs are open source. In addition to this reference guide, we provide source, API reference documentation, and a sample application:
| Resource | Location |
|---|---|
| GitHub repository | LaunchDarkly.SessionReplay |
| Published package | NuGet |
Prerequisites and dependencies
This SDK requires:- .NET 9.0 or .NET 10.0 with the MAUI workload installed
- Android SDK version 24 or higher (Android 7.0, Nougat)
- iOS 13.2 or higher
Get started
Follow these steps to get started:- Install the SDK
- Initialize the SDK
- Configure observability options
- Configure session replay
- Configure session replay privacy options
- Use custom masking
- Explore supported features
- Review observability data in LaunchDarkly
Install the SDK
Add theLaunchDarkly.SessionReplay NuGet package to your MAUI project:
dotnet clean before building. This is especially important for iOS targets, as stale build artifacts can cause issues. If you encounter dependency resolution problems, run dotnet restore first:
Initialize the SDK
Initialize the SDK by registering theObservabilityPlugin and SessionReplayPlugin as plugins on the LaunchDarkly client configuration. You should call this during your app’s startup, typically in MauiProgram.cs.
The observability and session replay features are registered as plugins using the PluginConfigurationBuilder. This integrates them directly with the LaunchDarkly client lifecycle.
Here’s how to initialize the SDK:
Configure observability options
You can customize the observability behavior by passing anObservabilityOptions object to ObservabilityPlugin.Builder().
Here is an example:
ObservabilityOptions configuration options are:
- ServiceName: The service name for the application. Defaults to
"observability-maui". - ServiceVersion: The version of the service. Defaults to
"0.1.0". - OtlpEndpoint: The endpoint URL for the OTLP exporter. Defaults to LaunchDarkly’s endpoint.
- BackendUrl: The backend URL for the observability service. Defaults to LaunchDarkly’s backend.
- ContextFriendlyName: An optional friendly name for the user context, displayed in the LaunchDarkly UI.
Configure session replay
The .NET MAUI SDK supports session replay, which captures snapshots of your app’s UI at regular intervals. This allows you to visually review user sessions in LaunchDarkly to better understand user behavior and diagnose issues. Session replay is configured through theSessionReplayOptions object passed to SessionReplayPlugin.Builder().
Here’s how to configure session replay:
SessionReplayOptions configuration options are:
- IsEnabled: Enables or disables session replay. Defaults to
true. - ServiceName: The service name for session replay telemetry. Defaults to
"sessionreplay-dotnet". - Privacy: Controls how UI elements are masked in the replay. To learn more, read Configure session replay privacy options.
Configure session replay privacy options
ThePrivacyOptions class controls how UI elements are masked during session replay. By default, text inputs are masked to protect user privacy.
Here’s how to configure privacy settings:
- MaskTextInputs: When
true, masks all text input fields. Defaults totrue. - MaskWebViews: When
true, masks the contents of web views. Web views are rendered as blank rectangles in session replays. Defaults tofalse. - MaskLabels: When
true, masks all text labels. Defaults tofalse. - MaskImages: When
true, masks all images. Defaults tofalse. - MinimumAlpha: Minimum alpha value for view visibility in recordings. Views with alpha below this threshold are not captured. Defaults to
0.02.
Common privacy configurations
For maximum privacy (recommended for production):Use custom masking
In addition to the privacy profile settings, you can explicitly mask or unmask individual MAUI views using theLDMask() and LDUnmask() extension methods. This gives you fine-grained control over which UI elements are captured in session replay recordings.
The
LDMask() and LDUnmask() methods work by accessing the underlying native platform view. The MAUI view’s handler must be attached before calling these methods. Call them after the view has been added to the visual tree, such as in a page’s Appearing event or after Handler is set..LDMask() and .LDUnmask() extension methods work on any MAUI View, and they apply the masking to the underlying native view on both Android and iOS.