---
title: "App Hangs"
description: "Learn about how to add app hang detection reporting."
url: https://docs.sentry.io/platforms/react-native/configuration/app-hangs/
---

# App Hangs | Sentry for React Native

This integration tracks app hangs. It's available on iOS, tvOS, macOS, and on Android through NDK-based detection (see [App Hang Tracking on Android](https://docs.sentry.io/platforms/react-native/configuration/app-hangs.md#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.

Every time an App Hang is detected Sentry creates an error event. App Hang Tracking is enabled by default. To disable it, set the `enableAppHangTracking` option to `false`:

```javascript
import * as Sentry from "@sentry/react-native";

Sentry.init({
  dsn: "DSN",
  enableAppHangTracking: false,
});
```

The app hang detection integration has a default timeout of two (2) seconds. This represents the minimum amount of time an app can be unresponsive before it is classified as hanging. You can change the timeout by setting the `appHangTimeoutInterval` option:

```javascript
import * as Sentry from "@sentry/react-native";

Sentry.init({
  dsn: "DSN",
  appHangTimeoutInterval: 1,
});
```

### [App Hang Tracking on Android](https://docs.sentry.io/platforms/react-native/configuration/app-hangs.md#app-hang-tracking-on-android)

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";

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)](https://docs.sentry.io/platforms/react-native/configuration/app-hangs.md#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.

```javascript
import * as Sentry from "@sentry/react-native";

Sentry.pauseAppHangTracking();

// Do something that might cause the app to hang,
// and you don't want the SDK to report it.

Sentry.resumeAppHangTracking();
```

To read more about how app hangs are detected, check out the `sentry-cocoa` [documentation](https://docs.sentry.io/platforms/apple/configuration/app-hangs.md).

## [MetricKit Hang Diagnostics](https://docs.sentry.io/platforms/react-native/configuration/app-hangs.md#metrickit-hang-diagnostics)

On iOS 15 and up, the operating system can also report hangs through MetricKit. These are separate from the app hangs described above, and the SDK reports them only if you enable the [MetricKit](https://docs.sentry.io/platforms/react-native/configuration/metric-kit.md) integration. If you enable both, a single unresponsive period may be reported twice, once from each source.
