Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions docs/platforms/android/session-replay/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,20 @@ SentryAndroid.init(context) { options ->

options.sessionReplay.onErrorSampleRate = 1.0
options.sessionReplay.sessionSampleRate = 0.1

// if your application has strict PII requirements we recommend using the Canvas screenshot strategy
// Note: this strategy does **not** support any masking options, it always masks text and images
// options.sessionReplay.screenshotStrategy = ScreenshotStrategyType.CANVAS
}
```

```XML {filename:AndroidManifest.xml}
<meta-data android:name="io.sentry.session-replay.on-error-sample-rate" android:value="1.0" />
<meta-data android:name="io.sentry.session-replay.session-sample-rate" android:value="0.1" />

<!-- if your application has strict PII requirements we recommend using the Canvas screenshot strategy -->
<!-- Note: this strategy does **not** support any masking options, it always masks text and images -->
<!-- <meta-data android:name="io.sentry.session-replay.screenshot-strategy" android:value="canvas" /> -->
```

## Verify
Expand Down Expand Up @@ -117,6 +125,32 @@ options.sessionReplay.maskAllImages = false
<meta-data android:name="io.sentry.session-replay.mask-all-images" android:value="false" />
```

### Screenshot Strategy

The SDK offers two strategies for recording replays: `PixelCopy` and `Canvas`.

`PixelCopy` uses Android's [PixelCopy](https://developer.android.com/reference/android/view/PixelCopy) API to capture screenshots of the current screen and takes a snapshot of the view hierarchy within the same frame. The view hierarchy is then used to find the position of controls such as text boxes, images, labels, and buttons and mask them with a block that's drawn over these controls. This strategy has slightly lower performance overhead but may result in masking misalignments due to the asynchronous nature of the PixelCopy API. We recommend using this strategy for apps that do not have strict PII requirements or do not require masking functionality.

`Canvas` uses Android's custom [Canvas](https://developer.android.com/reference/android/graphics/Canvas) API to redraw the screen contents onto a bitmap, masking all `drawText` and `drawBitmap` operations in the process to produce a masked screenshot. This strategy has a slightly higher performance overhead but provides more reliable masking. We recommend using this strategy for apps with strict PII requirements.

<Alert level="warning">

The `Canvas` screenshot strategy currently does **not** support any masking options. When the screenshot strategy is set to `Canvas`, it will **always** mask all texts, input fields and images, disregarding any masking options set. If you need more flexibility with masking, switch back to `PixelCopy`.

</Alert>

You can change the strategy as follows:

```kotlin
import io.sentry.ScreenshotStrategyType

options.sessionReplay.screenshotStrategy = ScreenshotStrategyType.CANVAS // or ScreenshotStrategyType.PIXEL_COPY (default)
```

```XML {filename:AndroidManifest.xml}
<meta-data android:name="io.sentry.session-replay.screenshot-strategy" android:value="canvas|pixelCopy" />
```

## Error Linking

Errors that happen while a replay is running will be linked to the replay, making it possible to jump between related issues and replays. However, it's **possible** that in some cases the error count reported on the **Replays Details** page won't match the actual errors that have been captured. That's because errors can be lost, and while this is uncommon, there are a few reasons why it could happen:
Expand Down
6 changes: 6 additions & 0 deletions docs/platforms/android/session-replay/privacy/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ description: "Learn how to mask parts of your app's data in Session Replay."

<Alert level="warning">

The masking options below only apply when using the default `PixelCopy` strategy. If you set the strategy to [Canvas](/platforms/android/session-replay/#screenshot-strategy), those options will be ignored and all sensitive content (texts, inputs, images) will be **always** masked.

</Alert>

<Alert level="warning">

Before enabling Session Replay in production, verify your masking configuration to ensure no sensitive data is captured. Our default settings aggressively mask potentially sensitive data, but if you modify these settings or update UI frameworks or system SDKs, you must thoroughly test your application. If you find any masking issues or sensitive data that should be masked but isn't, please [create a GitHub issue](https://github.com/getsentry/sentry-java/issues/new/choose) and avoid deploying to production with Session Replay enabled until the issue is resolved.

</Alert>
Expand Down
Loading