> ## Documentation Index
> Fetch the complete documentation index at: https://guide.daro.so/llms.txt
> Use this file to discover all available pages before exploring further.

# Getting Started

> Integrate the DARO React Native SDK into your app.

<Note>
  An Ad Unit defines an ad placement and format in your app. For the DARO 2.0 SDK, copy the **Ad Unit Key** from the updated dashboard. This is different from the app’s Integration Key. API parameters such as `adUnitId`, `unitId`, and `key`, and example placeholders such as `YOUR_AD_UNIT_ID`, keep their names but take that Ad Unit’s Ad Unit Key. Existing integrations using Ad Unit IDs remain supported. Do not confuse reporting or callback identifiers with the key for a new integration.
</Note>

## Before You Begin

<Warning>
  **Important: SDK initialization is required**

  Banner and native ads must be rendered only after SDK initialization completes. Rendering an ad component before initialization may cause an initialization error.

  Other formats such as interstitial and rewarded video ads must also be loaded after initialization.
</Warning>

### Requirements

* Android minSdkVersion: 23
* iOS 15.1 or later

<Warning>
  If your Android app's `minSdkVersion` is below 26, configure core library desugaring in the app module (`android/app/build.gradle` or `build.gradle.kts`). See [Android Getting Started](/en/sdk-integration-v2/android/get-started) for the setup.

  Without it, a class loading error can occur while reading the advertising ID on devices below API 26.

  The Expo config plugin does not apply this setting, so Expo projects must configure it too.
</Warning>

<Info>
  `react-native-daro@2.0.0` uses Android `so.daro:daro-sdk` 2.0.0 and iOS `DaroAds` 2.0.0

  The wrapper and native SDK versions are managed independently.
</Info>

<Check>
  Please double-check that your [app-ads.txt file](https://guide.daro.so/en/app-ads-txt-settings) is configured correctly.
</Check>

### Supported Ad Formats

* Banner/MREC
* Native
* Interstitial
* Rewarded
* Light Popup

## Installing the Package

```bash theme={null}
npm i react-native-daro@2.0.0
```

## Configuring an Expo Project

The unified SDK ships an **Expo config plugin**. Provide your Integration Key in the app config and the plugin applies the Android and iOS native setup during prebuild.

<Warning>
  DARO native modules are not available in Expo Go. Use a development build or a prebuilt app.
</Warning>

<Steps>
  <Step title="Add the plugin to your Expo config">
    Keep your existing Expo config and add the DARO entry to `expo.plugins`. Each platform takes **a single Integration Key**.

    ```json app.json theme={null}
    {
      "expo": {
        "plugins": [
          [
            "react-native-daro",
            {
              "ios": {
                "daroIntegrationKey": "YOUR_INTEGRATION_KEY"
              },
              "android": {
                "daroIntegrationKey": "YOUR_INTEGRATION_KEY"
              }
            }
          ]
        ]
      }
    }
    ```

    <Note>
      On iOS you can override the App Tracking Transparency prompt with `attUsageDescription`. A default message is used when it is omitted.
    </Note>
  </Step>

  <Step title="Run prebuild or EAS Build">
    ```bash theme={null}
    npx expo prebuild
    ```

    <Note>
      If your project uses a dynamic Expo config, manage the app identifier through your existing Expo/EAS configuration.
    </Note>
  </Step>
</Steps>

<Warning>
  Remove the 1.x key files and previous Expo key settings, then use `daroIntegrationKey` for each platform. For an existing app, follow the [migration guide](/en/sdk-integration-v2/react-native/migration-guide) in order.
</Warning>

After configuring the Expo plugin, continue to [Initializing the SDK](#initializing-the-sdk).

## Configuring a React Native CLI Project

If your project does not use the Expo config plugin, apply the build tools and Integration Key setup from [Android Getting Started](/en/sdk-integration-v2/android/get-started) and [iOS Getting Started](/en/sdk-integration-v2/ios_new/get-started).

On Android, add the `so.daro` plugin and the `so.daro:daro-sdk` dependency to the app module. Match the Android SDK version specified on this page for the React Native package. Also add these React Native settings to `android/gradle.properties`, merging the entries with any existing ignore list.

```properties theme={null}
android.useAndroidX=true
android.enableJetifier=true
android.jetifier.ignorelist=react-android,hermes-android
```

Use Kotlin Gradle plugin 2.2.20 or later.

On iOS, use the package's CocoaPods dependency. Follow [iOS Getting Started](/en/sdk-integration-v2/ios_new/get-started) to configure `DaroIntegrationKey`, `SKAdNetworkItems`, the tracking permission message, and the `post_install` hook, then run `pod install` from `ios/`. Keep the existing React Native `post_install` settings and add the hook to the same block.

## Initializing the SDK

Complete your app’s consent flow before initialization and pass the user’s choice and your app’s applicability decision. The `privacy` values below must come from your app; the example does not assume opt-in. GDPR accepts `optIn`, `optOut`, `notApplicable`, or `unknown`; CCPA accepts `optIn`, `optOut`, or `notApplicable`; COPPA accepts `child` or `notChild`. Set COPPA before initialization. Include any previously supplied consent string when updating its status.

Use the code below to initialize the SDK.

Supply `privacy` as a stable object after the consent flow completes; creating a new object on each render would repeat this initialization effect.

```tsx theme={null}
import { useEffect, useState } from "react";
import { View } from "react-native";
import { AdBannerView, AdFormat, initialize, setGdpr, setCcpa, setCoppa } from "react-native-daro";
import type { DaroGdprStatus, DaroCcpaStatus, DaroCoppaStatus } from "react-native-daro";

type Privacy = {
  gdpr: DaroGdprStatus;
  ccpa: DaroCcpaStatus;
  coppa: DaroCoppaStatus;
  gdprConsentString?: string;
  ccpaConsentString?: string;
};

const BANNER_AD_UNIT_ID = "YOUR_BANNER_AD_UNIT_ID";

function App({ privacy }: { privacy: Privacy }) {
  const [isInitialized, setIsInitialized] = useState(false);

  useEffect(() => {
    async function startAds() {
      await setGdpr(privacy.gdpr, privacy.gdprConsentString);
      await setCcpa(privacy.ccpa, privacy.ccpaConsentString);
      await setCoppa(privacy.coppa);
      await initialize();
    }
    startAds()
      .then(() => setIsInitialized(true))
      .catch(console.error);
  }, [privacy]);

  // Render ad components only after initialization completes
  return (
    <View>
      {isInitialized && (
        <AdBannerView
          adFormat={AdFormat.BANNER}
          adUnitId={BANNER_AD_UNIT_ID}
        />
      )}
    </View>
  );
}
```

## Best Practices

### Managing SDK Initialization

Recommendations for managing the SDK efficiently and avoiding errors.

1. **`Call initialize() at app startup`**
   * Initialize the SDK at your app entry point (App.js or index.js)
2. **Track initialization state**
   * Keep the initialization result in state so you can control when ads render
3. **Guard every banner and native ad component with conditional rendering**
   * Make sure ad components never render before initialization completes

## Next Steps

Once integration and initialization are complete, continue to the guide for the ad format you want to use.

* [Banner/MREC Ads](/en/sdk-integration-v2/react-native/ad-formats/banner)
* [Native Ads](/en/sdk-integration-v2/react-native/ad-formats/native)
* [Interstitial Ads](/en/sdk-integration-v2/react-native/ad-formats/interstitial)
* [Rewarded Video Ads](/en/sdk-integration-v2/react-native/ad-formats/rewarded)
* [Light Popup Ads](/en/sdk-integration-v2/react-native/ad-formats/lightpopup)
