diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md new file mode 120000 index 0000000000000..be77ac83a1895 --- /dev/null +++ b/.github/copilot-instructions.md @@ -0,0 +1 @@ +../AGENTS.md \ No newline at end of file diff --git a/docs/platforms/dotnet/guides/android/configuration/native-options.mdx b/docs/platforms/dotnet/guides/android/configuration/native-options.mdx new file mode 100644 index 0000000000000..ffd3764b83ab5 --- /dev/null +++ b/docs/platforms/dotnet/guides/android/configuration/native-options.mdx @@ -0,0 +1,285 @@ +--- +title: Android Native Options +description: "Configure the embedded Sentry Android SDK when using .NET for Android." +sidebar_order: 10 +--- + +When you use the .NET for Android integration, Sentry embeds the [Sentry Android SDK](/platforms/android/) to provide native crash reporting and other Android-specific features. The `options.Native` property exposes configuration for this embedded SDK. + +```csharp +SentrySdk.Init(options => +{ + options.Dsn = "___PUBLIC_DSN___"; + + // Native Android SDK options: + options.Native.AnrEnabled = true; + options.Native.EnableNdk = true; +}); +``` + +These options are also available in [MAUI](/platforms/dotnet/guides/maui/) when targeting Android. + +## Application Not Responding (ANR) + + + +Enables detection of [Application Not Responding (ANR)](/platforms/android/configuration/app-not-respond/) errors — events where the main thread is blocked for too long. Enabled by default. + + + + + +Whether ANR events are reported in debug builds. Disabled by default to avoid noise during development. + + + + + +How long the main thread must be unresponsive before an ANR event is captured. Default is 5 seconds. + + + +## Breadcrumbs + +The Android SDK automatically captures breadcrumbs for various system events. Each category can be enabled or disabled independently. + + + +Adds breadcrumbs for `Activity` lifecycle events (created, started, resumed, paused, stopped, destroyed). + +See [Automatic Breadcrumbs](/platforms/android/enriching-events/breadcrumbs/). + + + + + +Adds breadcrumbs for `App` component events. + +See [Automatic Breadcrumbs](/platforms/android/enriching-events/breadcrumbs/). + + + + + +Adds breadcrumbs for `App` lifecycle events (foregrounded, backgrounded). + +See [Automatic Breadcrumbs](/platforms/android/enriching-events/breadcrumbs/). + + + + + +Adds breadcrumbs when network connectivity changes. + +See [Automatic Breadcrumbs](/platforms/android/enriching-events/breadcrumbs/). + + + + + +Adds breadcrumbs for system events such as battery state changes, low memory warnings, and timezone changes. + +See [Automatic Breadcrumbs](/platforms/android/enriching-events/breadcrumbs/). + + + + + +Adds breadcrumbs when the user interacts with UI elements (taps, swipes, etc.). + +See [Automatic Breadcrumbs](/platforms/android/enriching-events/breadcrumbs/). + + + +## Performance + + + +Automatically creates transactions for `Activity` lifecycle events. Requires `TracesSampleRate` or `TracesSampler` to be configured. + +See [Activity Instrumentation](/platforms/android/performance/instrumentation/automatic-instrumentation/#activity-instrumentation). + + + + + +Whether transactions created for Activity lifecycle events finish automatically when the Activity is fully drawn. Requires `EnableAutoActivityLifecycleTracing` to be enabled. + +See [Activity Instrumentation](/platforms/android/performance/instrumentation/automatic-instrumentation/#activity-instrumentation). + + + + + +Automatically creates traces for user interaction events (button clicks, etc.). Disabled by default. + +See [User Interaction Instrumentation](/platforms/android/performance/instrumentation/automatic-instrumentation/#user-interaction-instrumentation). + + + + + +Enables tracing features on the embedded Android SDK. When disabled, the .NET SDK still handles traces for managed code, but the native Android SDK will not create its own traces. + + + + + +Profiling sample rate for the native Android SDK, between `0.0` and `1.0`. Disabled when `null`. + + + +## Enriching Events + + + +Automatically attaches a screenshot when the native Android SDK captures a Java-based error or exception. + + + +This feature is provided by the embedded Sentry Android SDK and only works for Java-based exceptions. For .NET managed code screenshots, see Screenshots. + + + +See [Screenshots](/platforms/android/enriching-events/screenshots/). + + + + + +Automatically attaches information about all threads to all logged events. + + + + + +Checks whether the device has been rooted and includes this in event context. Disable if your app store flags this check as harmful. + + + +## Android NDK + + + +Enables the [Android NDK integration](/platforms/android/configuration/using-ndk/) for native C/C++ crash reporting. Disable only if you don't need native crash reports and want to reduce overhead. + + + +## Networking + + + +Connection timeout on the HTTP connection used by the Java SDK when sending events to Sentry. + + + + + +Read timeout on the HTTP connection used by the Java SDK when sending events to Sentry. + + + +## Error Handling + + + +Enables a hook that flushes events when the main Java thread shuts down, ensuring events are sent before the process exits. + + + + + +Enables the handler that attaches to Java's `Thread.UncaughtExceptionHandler` to capture unhandled Java exceptions. + + + + + +When enabled, prints uncaught Java error stack traces to stderr in addition to sending them to Sentry. + + + + + +When enabled, the `BeforeSend` callback configured on `SentryOptions` will also be invoked for events that originate from the embedded Android SDK. + + + +This is an experimental feature. The .NET and Android SDKs don't implement identical features, so some optional event properties may be lost when round-tripping between the two SDKs. + + + + + +## Stack Traces + +Use these methods to control which Java packages are considered "in-app" in stack traces. Note that these use Java package names, not .NET namespaces. + + + +Excludes frames matching the given Java package prefix from being flagged as "in-app" in stack traces. + +```csharp +options.Native.AddInAppExclude("java.util."); +options.Native.AddInAppExclude("org.apache.logging.log4j."); +``` + +See [In-App Exclude](/platforms/java/configuration/options/#in-app-exclude). + + + + + +Includes frames matching the given Java package prefix as "in-app" in stack traces. + +```csharp +options.Native.AddInAppInclude("io.sentry.samples."); +``` + +See [In-App Include](/platforms/java/configuration/options/#in-app-include). + + + +## Session Replay + +Session Replay for Android is currently experimental and must be opted into. + + + +Sample rate for all sessions, between `0.0` and `1.0`. Set to `0.0` or leave as `null` to disable session replay for regular sessions. + + + + + +Sample rate for sessions that encountered an error, between `0.0` and `1.0`. Set to `0.0` or leave as `null` to disable session replay for errored sessions. + + + + + +Masks all text content in session replay recordings to protect user privacy. Enabled by default. + + + + + +Masks all images in session replay recordings to protect user privacy. Enabled by default. + + + +For finer-grained control of masking, you can mask or unmask entire classes of `VisualElement`: + +```csharp +// Unmask all Buttons (override the default mask-all behaviour) +options.Native.ExperimentalOptions.SessionReplay.UnmaskControlsOfType