Initialization

Import and configure AATKit

Import modules

There are three modules you can import to use AATKit:

  • RNAatkit – main module which allows to initialize plugin. Also provides API to reload and show interstitial ads.

  • RNAatkitBanner – the banner ad component.

  • RNAatkitNativeAd – the native ad component.

Example of importing modules:

import {
    RNAatkit,
    RNAatkitBanner,
    RNAatkitNativeAd
} from '@addapptr/react-native-aatkit'

Initialize AATKit

Use initWithConfiguration function from RNAatkit module to initialize AATKit. This operation should be run only once during the application lifecycle. You can pass JSON object as the parameter to set desired configuration. You can find all configuration options here. Please see the example below where AATKit is initialized with test mode using ID 136:

componentWillMount() {
    RNAatkit.initWithConfiguration({
        testModeAccountID: 136,
        consent: {
            type: RNAatkit.ConsentType_ManagedCMPGoogle
        }
    });
}

Add optional networks

Optional networks are disabled by default. If you want to include them to the build, follow instructions below.

Android

  1. Find node_modules/@addapptr/react-native-aatkit/android/build.gradle file.

  2. Uncomment network dependencies which should be included to the build.

iOS

  1. Find node_modules/@addapptr/react-native-aatkit/RNAatkit.podspec file.

  2. Uncomment network dependencies which should be included to the build.

Last updated