You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Screenshot masking allows you to mask sensitive data in screenshots before they are captured. You can customize this behavior to fit your application's needs.
22
+
23
+
<Alert>
24
+
25
+
Screenshot masking requires the `sentry-android-replay` module at runtime. This module is included by default if you use the `sentry-android` dependency. If you only depend on `sentry-android-core`, add the replay module explicitly:
If masking options are configured but the module is not available at runtime, the SDK will skip capturing screenshots entirely to avoid leaking sensitive data.
40
+
41
+
</Alert>
42
+
43
+
### Default Masking Behavior
44
+
45
+
Unlike Session Replay, screenshot masking is **disabled by default**. You can enable masking for all text and image content:
When `setMaskAllImages(true)` is set, the SDK will also mask `WebView`, `VideoView`, CameraX `PreviewView`, ExoPlayer, and Media3 player views in addition to `ImageView`.
75
+
76
+
</Alert>
77
+
78
+
### Mask by View Class
79
+
80
+
You can choose which type of view to mask or unmask by using `addMaskViewClass` or `addUnmaskViewClass`. These accept fully-qualified class names and apply to all subclasses of the specified class as well.
Alternatively, you can use the `android:tag` attribute with the `sentry-mask` or `sentry-unmask` string values:
146
+
147
+
```xml
148
+
<TextView
149
+
android:layout_width="wrap_content"
150
+
android:layout_height="wrap_content"
151
+
android:tag="sentry-mask"
152
+
android:text="Sensitive data" />
153
+
```
154
+
155
+
### Jetpack Compose
156
+
157
+
For Jetpack Compose, use the `sentryReplayMask()` and `sentryReplayUnmask()` modifiers:
158
+
159
+
```kotlin
160
+
importio.sentry.android.replay.sentryReplayMask
161
+
importio.sentry.android.replay.sentryReplayUnmask
162
+
163
+
@Composable
164
+
funMyScreen() {
165
+
Column {
166
+
Text(
167
+
text ="Sensitive info",
168
+
modifier =Modifier.sentryReplayMask()
169
+
)
170
+
Text(
171
+
text ="Public info",
172
+
modifier =Modifier.sentryReplayUnmask()
173
+
)
174
+
}
175
+
}
176
+
```
177
+
19
178
## Viewing Screenshots
20
179
21
180
If one is available, you'll see a thumbnail of the screenshot when you click on a specific issue from the [**Issues**](https://demo.sentry.io/issues/) page.
Copy file name to clipboardExpand all lines: platform-includes/enriching-events/attach-screenshots/android.mdx
+6Lines changed: 6 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,6 +4,12 @@
4
4
</application>
5
5
```
6
6
7
+
<Alertlevel="warning">
8
+
9
+
Before enabling screenshots in production, verify your masking configuration to ensure no sensitive data is captured. 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 screenshots enabled until the issue is resolved.
0 commit comments