From e136d4313b6ae18a2b547a4e2f42cc43dd24f428 Mon Sep 17 00:00:00 2001 From: Antonis Lilis Date: Fri, 31 Jul 2026 10:44:45 +0200 Subject: [PATCH 1/2] feat(react-native): Document Android NDK app hang tracking options Add docs for enableNdkAppHangTracking and ndkAppHangTimeoutIntervalMillis, which surface sentry-native's heartbeat-based app-hang detection on Android. Co-Authored-By: Claude Opus 4.8 --- .../common/configuration/app-hangs.mdx | 27 ++++++++++++++++++- .../common/configuration/options.mdx | 12 +++++++++ 2 files changed, 38 insertions(+), 1 deletion(-) diff --git a/docs/platforms/react-native/common/configuration/app-hangs.mdx b/docs/platforms/react-native/common/configuration/app-hangs.mdx index be30f3e427356..782e857446ed3 100644 --- a/docs/platforms/react-native/common/configuration/app-hangs.mdx +++ b/docs/platforms/react-native/common/configuration/app-hangs.mdx @@ -4,7 +4,7 @@ sidebar_order: 11 description: "Learn about how to add app hang detection reporting." --- -This integration tracks app hangs. This feature is available on iOS, tvOS, and macOS. +This integration tracks app hangs. It's available on iOS, tvOS, and macOS, and on Android through NDK-based detection (see [App Hang Tracking on Android](#app-hang-tracking-on-android)). Trying to use an unresponsive app is extremely frustrating for users. There are many reasons why an app may become unresponsive, such as long-running code, infinite loop bugs, and so on. With app hang tracking you can detect and fix them. @@ -30,6 +30,31 @@ Sentry.init({ }); ``` +### App Hang Tracking on Android + +The `enableAppHangTracking` and `appHangTimeoutInterval` options above apply to iOS only. On Android, you can enable `sentry-native`'s heartbeat-based app hang detection with the `enableNdkAppHangTracking` option. This is independent of the JVM-based ANR detection and requires NDK to be enabled. It's disabled by default: + +```javascript +import * as Sentry from "@sentry/react-native"; + +Sentry.init({ + dsn: "DSN", + enableNdkAppHangTracking: true, +}); +``` + +The default timeout is 5000 milliseconds. This represents the minimum amount of time the app can be unresponsive before it's classified as hanging. You can change the timeout by setting the `ndkAppHangTimeoutIntervalMillis` option: + +```javascript +import * as Sentry from "@sentry/react-native"; + +Sentry.init({ + dsn: "DSN", + enableNdkAppHangTracking: true, + ndkAppHangTimeoutIntervalMillis: 3000, +}); +``` + ### Pause and Resume App Hang Tracking (iOS only) Starting with version 8.13.0, you can pause and resume app hang tracking at runtime. This is useful when showing system dialogs (for example, permission prompts) that block the main thread but aren't real app hangs. diff --git a/docs/platforms/react-native/common/configuration/options.mdx b/docs/platforms/react-native/common/configuration/options.mdx index db168b06fc67d..20223ecb13bbc 100644 --- a/docs/platforms/react-native/common/configuration/options.mdx +++ b/docs/platforms/react-native/common/configuration/options.mdx @@ -418,6 +418,18 @@ When enabled, ANR events whose stacktraces contain only system frames (for examp + + +Set this boolean to `true` to enable `sentry-native`'s heartbeat-based app hang detection on Android. This is independent of the JVM-based ANR detection and requires NDK to be enabled. Use `ndkAppHangTimeoutIntervalMillis` to configure the threshold. + + + + + +The minimum amount of time (in milliseconds) an app must be unresponsive before it's classified as an app hang when using NDK app hang detection on Android. Only has an effect if `enableNdkAppHangTracking` is `true`. + + + Set this boolean to `false` to disable auto [performance monitoring](/product/dashboards/sentry-dashboards/) tracking. From 4ea02a2124baa03e0a665ed32fece8e8ac9bb41f Mon Sep 17 00:00:00 2001 From: Antonis Lilis Date: Fri, 31 Jul 2026 10:53:13 +0200 Subject: [PATCH 2/2] docs: clarify app hang tracking applies to iOS, tvOS, and macOS Address review feedback: the iOS app hang options are not iOS-only. Co-Authored-By: Claude Opus 4.8 --- docs/platforms/react-native/common/configuration/app-hangs.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/platforms/react-native/common/configuration/app-hangs.mdx b/docs/platforms/react-native/common/configuration/app-hangs.mdx index 782e857446ed3..a4e0a80f6696e 100644 --- a/docs/platforms/react-native/common/configuration/app-hangs.mdx +++ b/docs/platforms/react-native/common/configuration/app-hangs.mdx @@ -32,7 +32,7 @@ Sentry.init({ ### App Hang Tracking on Android -The `enableAppHangTracking` and `appHangTimeoutInterval` options above apply to iOS only. On Android, you can enable `sentry-native`'s heartbeat-based app hang detection with the `enableNdkAppHangTracking` option. This is independent of the JVM-based ANR detection and requires NDK to be enabled. It's disabled by default: +The `enableAppHangTracking` and `appHangTimeoutInterval` options above apply to iOS, tvOS, and macOS. On Android, you can enable `sentry-native`'s heartbeat-based app hang detection with the `enableNdkAppHangTracking` option. This is independent of the JVM-based ANR detection and requires NDK to be enabled. It's disabled by default: ```javascript import * as Sentry from "@sentry/react-native";