# Mobile & desktop

> **For agents:** paste the DSN from `list_keys` into the snippet for the platform; create the project with the matching platform id (`create_project(org="acme", slug="web", name="Web", platform="android")`). Platforms on this page: `android`, `ios`, `react-native`, `flutter`, `electron`.

Mobile SDKs capture crashes that happen before your code runs (ContentProvider init on Android, crash-on-disk-then-send on iOS) and report **release health sessions** by default, which is what powers crash-free rates in [Releases](https://docs.bugwatch.io/product/releases.md). Sessions are free — they do not count against the event meter.

Replace `https://<public_key>@ingest.bugwatch.io/<project_number>` with the DSN from `list_keys` or the project's settings page.

## Android

- Platform id: `android` · Language: Kotlin · Runs in: mobile
- Install: `implementation 'io.sentry:sentry-android:8.+'`
- Files: AndroidManifest.xml

```xml
<application>
  <meta-data android:name="io.sentry.dsn" android:value="https://<public_key>@ingest.bugwatch.io/<project_number>" />
  <meta-data android:name="io.sentry.traces.sample-rate" android:value="1.0" />
  <meta-data android:name="io.sentry.session-tracking.enable" android:value="true" />
</application>
```

Lifecycle notes:

- Init happens via a ContentProvider before Application.onCreate — crashes during startup are captured.
- ANRs, native (NDK) crashes and release health sessions are on by default; ProGuard/R8 mappings upload with the Gradle plugin so traces deobfuscate.

## iOS / Swift

- Platform id: `ios` · Language: Swift · Runs in: mobile
- Install: `SPM: https://github.com/getsentry/sentry-cocoa`
- Files: App.swift

```swift
import Sentry

@main struct MyApp: App {
    init() {
        SentrySDK.start { o in
            o.dsn = "https://<public_key>@ingest.bugwatch.io/<project_number>"
            o.tracesSampleRate = 1.0
            o.enableAppHangTracking = true
        }
    }
}
```

Lifecycle notes:

- Start in the App initializer (or AppDelegate didFinishLaunching) before any UI; crashes are written to disk and sent on next launch.
- Upload dSYMs with sentry-cli (or the Xcode build phase) so native frames symbolicate; release health sessions track foreground/background automatically.

## React Native

- Platform id: `react-native` · Language: TypeScript · Runs in: mobile
- Install: `npx @sentry/wizard@latest -i reactNative`

```tsx
import * as Sentry from "@sentry/react-native";
Sentry.init({ dsn: "https://<public_key>@ingest.bugwatch.io/<project_number>", tracesSampleRate: 1.0 });
export default Sentry.wrap(App);
```

Lifecycle notes:

- Sentry.wrap(App) adds the error boundary and touch breadcrumbs; native crashes on both platforms report through the bundled native SDKs.
- Upload JS source maps AND native symbols (dSYM / ProGuard) per release — the Metro plugin handles source maps.

## Flutter

- Platform id: `flutter` · Language: Dart · Runs in: mobile
- Install: `flutter pub add sentry_flutter`

```dart
await SentryFlutter.init(
  (o) { o.dsn = "https://<public_key>@ingest.bugwatch.io/<project_number>"; o.tracesSampleRate = 1.0; },
  appRunner: () => runApp(const MyApp()),
);
```

Lifecycle notes:

- appRunner wraps runApp in a zone so async errors and Flutter framework errors are captured.
- Obfuscated builds need `flutter build --split-debug-info` symbols uploaded with sentry-cli.

## Electron

- Platform id: `electron` · Language: TypeScript · Runs in: desktop
- Install: `npm install @sentry/electron`

```ts
// main process
import * as Sentry from "@sentry/electron/main";
Sentry.init({ dsn: "https://<public_key>@ingest.bugwatch.io/<project_number>" });

// each renderer
import * as Sentry from "@sentry/electron/renderer";
Sentry.init({ dsn: "https://<public_key>@ingest.bugwatch.io/<project_number>" });
```

Lifecycle notes:

- Main and renderer processes init separately; renderer events are forwarded through IPC so both share the release/context.
- Native crashes come through the crashpad minidump integration.

## Symbolication for this family

Native frames need symbols uploaded per release: dSYMs on iOS (`sentry-cli --url https://api.bugwatch.io debug-files upload` or the Xcode build phase), ProGuard/R8 mappings on Android (Gradle plugin), `--split-debug-info` output for obfuscated Flutter builds, plus JS source maps for React Native and Electron renderers. Point every uploader at `https://api.bugwatch.io` with a `release:write` token.
