Skip to content

Commit 3bf4c18

Browse files
chore: Demonstrate screen capture in mobile samples (#5040)
* chore: Demonstrate screen capture in mobile samples Resolves #4117 - #4117 * Review feedback
1 parent 87faa9e commit 3bf4c18

4 files changed

Lines changed: 15 additions & 1 deletion

File tree

samples/Sentry.Samples.Android/MainActivity.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@ protected override void OnCreate(Bundle? savedInstanceState)
3131
// Enable Native Android SDK ANR detection
3232
options.Native.AnrEnabled = true;
3333

34+
// If your app doesn't have sensitive data, you can attach screenshots automatically when a Java/native
35+
// error is captured.
36+
// https://docs.sentry.io/platforms/android/configuration/options/#attachScreenshot
37+
options.Native.AttachScreenshot = true;
38+
3439
// Currently experimental support is only available on Android
3540
options.Native.ExperimentalOptions.SessionReplay.OnErrorSampleRate = 1.0;
3641
options.Native.ExperimentalOptions.SessionReplay.SessionSampleRate = 1.0;

samples/Sentry.Samples.Ios/AppDelegate.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ public override bool FinishedLaunching(UIApplication application, NSDictionary?
3636
// Enable Native iOS SDK App Hangs detection
3737
options.Native.EnableAppHangTracking = true;
3838

39+
// If your app doesn't have sensitive data, you can get screenshots on error events automatically
40+
// https://docs.sentry.io/platforms/apple/guides/ios/configuration/options/#attachScreenshot
41+
options.Native.AttachScreenshot = true;
42+
3943
options.CacheDirectoryPath = Path.GetTempPath();
4044

4145
options.SetBeforeSend(evt =>

samples/Sentry.Samples.MacCatalyst/AppDelegate.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ public override bool FinishedLaunching(UIApplication application, NSDictionary?
2323
options.Dsn = EnvironmentVariables.Dsn;
2424
#endif
2525
options.Debug = true;
26+
27+
// If your app doesn't have sensitive data, you can get screenshots on error events automatically
28+
// https://docs.sentry.io/platforms/apple/guides/ios/configuration/options/#attachScreenshot
29+
options.Native.AttachScreenshot = true;
2630
});
2731

2832
// Try out the Sentry SDK

samples/Sentry.Samples.Maui/MauiProgram.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ public static MauiApp CreateMauiApp()
3030
// If you want to see everything we can capture from MAUI, you may wish to use a larger value.
3131
options.MaxBreadcrumbs = 1000;
3232

33-
// Be aware that screenshots may contain PII
33+
// If your app doesn't have sensitive data, you can get screenshots on error events automatically
34+
// https://docs.sentry.io/platforms/dotnet/guides/maui/configuration/options/#AttachScreenshot
3435
options.AttachScreenshot = true;
3536

3637
options.Debug = true;

0 commit comments

Comments
 (0)