# BundleDrop.init — Bundle Drop Docs

> Initialize the Bundle Drop update manager with BundleDrop.init to control how OTA updates are checked, downloaded, and applied.

Canonical: https://bundledrop.app/docs/init-update-manager

## What `BundleDrop.init` Is

`BundleDrop.init` is the required startup entrypoint for the Bundle Drop runtime.

Call it once when the app starts. It sets the runtime environment and initial channel for the current app process, hydrates local OTA state, and optionally runs the startup update flow based on your selected policy.

## When to Use It

Use `BundleDrop.init` in every app that uses Bundle Drop.

That usually means:

- calling it from `index.js` or your earliest startup file
- passing the runtime `environment` from your own app config
- deciding whether OTA should be enabled for that runtime
- choosing the startup policy that fits your app

If you want custom buttons, prompts, or settings screens, still call `BundleDrop.init` once and then use [useBundleDrop](/docs/use-bundle-drop) for the UI layer.

## Main Options

- `environment`: required runtime label such as `production`, `staging`, or `development`. This is your app's own environment value — you define it, and it is unrelated to the Bundle Drop platform's internal environments. Keep it consistent across builds so audience reporting and targeting stay meaningful.
- `enabled`: defaults to `true`; set `false` to keep Bundle Drop mounted but inactive for that runtime
- `channelName`: initial channel for the current app process
- `policy`: `manual`, `on-next-launch`, or `immediate`
- `onStatusUpdate`: callback for human-readable status updates
- `checkOnly`: resolve on startup without downloading or applying

## Return Shape

`BundleDrop.init(...)` returns `void`. It initializes the singleton runtime synchronously and handles any async startup work internally.

## Typical Usage

**index.js**

```ts
import { BundleDrop } from "@gfean/react-native-bundle-drop";

BundleDrop.init({
  enabled: !__DEV__,
  environment: __DEV__ ? "development" : "production",
  channelName: "develop",
  policy: __DEV__ ? "manual" : "on-next-launch",
  onStatusUpdate: (msg) => console.log("[OTA]", msg),
});
```

## How It Works in Practice

At a high level, `BundleDrop.init`:

1. initializes the runtime service
2. loads local update state
3. reconciles native rollback and health state
4. if enabled, follows the selected [Update Policies](/docs/update-policies) startup behavior

That makes it the right choice when you want one runtime source of truth for update state and channel selection.

## Health Reporting

By default, Bundle Drop marks a newly launched OTA bundle healthy after native React content appearance and the configured commit delay.

If your app needs stricter startup validation, configure manual health reporting in `bundle.drop.config.js` and call `BundleDrop.reportHealthy()` after your critical startup work completes.

**bundle.drop.config.js**

```ts
module.exports = {
  // ...other config
  rollback: {
    healthCheckMode: "manual",
    maxCrashCount: 3,
  },
};
```

**index.js**

```ts
import { BundleDrop } from "@gfean/react-native-bundle-drop";

BundleDrop.init({
  environment: "production",
  policy: "on-next-launch",
});
```

**App.tsx**

```tsx
import { useEffect } from "react";
import { BundleDrop } from "@gfean/react-native-bundle-drop";

export function App({ appReady }: { appReady: boolean }) {
  useEffect(() => {
    // Replace appReady with your own startup readiness condition.
    if (!appReady) return;

    void BundleDrop.reportHealthy();
  }, [appReady]);

  return <RootNavigator />;
}
```

In manual health mode, do not forget this call. If a candidate is never reported healthy, later distinct launches classify its incomplete attempts and Bundle Drop can eventually roll it back.

## Best Fit

`BundleDrop.init` is best for:

- every app using Bundle Drop
- automated startup checks and downloads
- teams that want a single runtime controller before rendering OTA-aware UI

## Alternative

If you want manual control over checking, downloading, and applying updates from your own interface, use [useBundleDrop](/docs/use-bundle-drop) after startup init.

## Related Docs

- For lower-level direct functions, see [Runtime APIs](/docs/runtime-apis).
- For policy behavior, see [Update Policies](/docs/update-policies).
- For manual UI flows, see [useBundleDrop](/docs/use-bundle-drop).
- For SDK overview, see [SDK Integration](/docs/sdk-integration).
