Skip to content
This repository was archived by the owner on Aug 14, 2024. It is now read-only.

Commit 2cf5e65

Browse files
bruno-garciarhcarvalhoAbhiPrasad
authored
sdk built-in screenshot feature (#422)
Co-authored-by: Rodolfo Carvalho <[email protected]> Co-authored-by: Abhijeet Prasad <[email protected]>
1 parent a1c3888 commit 2cf5e65

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/docs/sdk/features.mdx

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,22 @@ envelope item, the SDK must discard items larger than the `maxAttachmentSize`. E
141141
useful because attachments could quickly eat up the users' disk space. Furthermore, Relay has a
142142
[maximum size for attachments](https://docs.sentry.io/product/relay/options/), and we want to reduce unnecessary requests.
143143

144+
## Screenshots
145+
146+
When the user opts-in, if technically possible, take a screenshot of the application and include as an [attachment](#attachments) to the [envelope](/sdk/envelopes/) with the event.
147+
148+
This feature only applies to SDKs with a user interface, such as Mobile and Desktop.
149+
In some environments such as native iOS, taking a screenshot requires the UI thread and in the event of a crash, that might not be available. So inherently this feature will be a best effort solution.
150+
It's advised to provide this feature through a single option called `attachScreenshot`. That's the preferred way but in platforms such as Flutter, a wrapping widget is required so documentation can point users to that instead of the suggested option name.
151+
152+
The feature is achieved by adding an attachment with:
153+
154+
* File name `screenshot.jpg` or `screenshot.png`
155+
* Image size, if possible should stay below 2 MB but quality/size could be configurable
156+
* `ContentType: image/jpg` or `ContentType: image/png`
157+
158+
Whenever possible, avoid adding the attachment altogether if taking the screenshot fails. Alternatively, when streaming, it's possible the envelope header was already flushed through before the attempt to take the screenshot happens. In this case, a 0 byte attachment will be included. In that case, Sentry will not show a screenshot preview.
159+
144160
## Before-Send Hook
145161

146162
Hook called with the event (and on some platforms the hint) that allow the user to decide whether an event should be sent or not. This can also be used to further modify the event.

0 commit comments

Comments
 (0)