Skip to main content

Requirements

Before integrating the AppDNA React Native SDK, ensure your project meets the following minimum requirements:
RequirementMinimum Version
React Native0.72.0+
React18.0+
TypeScript5.0+
Projects targeting React Native versions below 0.72.0 are not supported. The SDK relies on the New Architecture bridge and TurboModule capabilities introduced in 0.72.

Installation

npm

npm install @appdna/react-native-sdk

yarn

yarn add @appdna/react-native-sdk

Package Info

FieldValue
Package@appdna/react-native-sdk
Version1.0.0

Architecture

The @appdna/react-native-sdk package is a TypeScript thin wrapper around the native iOS and Android AppDNA SDKs. All core logic — event batching, config caching, billing, push handling — is delegated to the native modules via React Native’s NativeModules bridge. The package has no runtime JavaScript dependencies. The Dart-level API marshals method calls down to the native side and surfaces results back as Promises and event listeners.
You do not need to interact with NativeModules directly. The AppDNA class and its module accessors provide a high-level TypeScript API that wraps all native communication.

Firebase Configuration

The AppDNA SDK uses Firebase Firestore for real-time configuration delivery (paywalls, experiments, feature flags, onboarding flows). You must add Firebase configuration files for each platform your app targets.

Step 1: Download Firebase Config Files

  1. Log into your AppDNA Console
  2. Go to Settings → SDK
  3. Click Download Firebase Config to download both:
    • GoogleService-Info-AppDNA.plist (for iOS)
    • google-services-appdna.json (for Android)

Step 2: Add iOS Configuration

  1. Open the ios/ workspace in Xcode
  2. Drag GoogleService-Info-AppDNA.plist into your Xcode project navigator
  3. Ensure “Copy items if needed” is checked
  4. Select your app target in the “Add to targets” section

Step 3: Add Android Configuration

Place the google-services-appdna.json file in the Android app directory:
your-project/
  android/
    app/
      google-services-appdna.json    <-- place here
Ensure the Google Services plugin is applied in your android/app/build.gradle:
apply plugin: 'com.google.gms.google-services'
And the classpath is added to android/build.gradle:
buildscript {
    dependencies {
        classpath 'com.google.gms:google-services:4.4.0'
    }
}

Step 4: Install React Native Firebase

Install the @react-native-firebase/app package:
npm install @react-native-firebase/app
Or with yarn:
yarn add @react-native-firebase/app
Then install iOS pods:
cd ios && pod install
React Native Firebase auto-initializes from the config files. You do not need to call any Firebase initialization method manually in your JavaScript/TypeScript code.
Without the Firebase config files, the SDK cannot fetch remote configuration (paywalls, experiments, feature flags). Events will still be tracked, but remote features will not work.

iOS Setup

After installing the npm package, install the native CocoaPods dependency:
cd ios && pod install
If pod install fails, make sure your CocoaPods repo is up to date by running pod repo update first.

Android Setup

No additional setup is needed for Android. The native module is auto-linked by React Native when you install the package.

Import

Import the SDK in any TypeScript or JavaScript file where you need to use it:
import { AppDNA } from '@appdna/react-native-sdk';

Verify Installation

After adding the dependency, verify the SDK is correctly installed by printing the version:
import { AppDNA } from '@appdna/react-native-sdk';

const version = await AppDNA.getSdkVersion();
console.log(version); // "1.0.0"
You should see 1.0.0 printed in the Metro console. If the import fails, make sure you ran pod install for iOS and rebuilt the app. For Android, a clean rebuild (cd android && ./gradlew clean) may be needed.

Next Steps

Once the SDK is installed, proceed to the Quickstart guide to configure the SDK and start tracking events.