Add Adrop to React Native
Prerequisites
Install your preferred editor or IDE.
Make sure that your app meets the following requirements:
React Native:
0.71 or higher
Android:
Targets API level 23 (M) or higher
Uses Android 6.0 or higher
minSdkVersion
23
Uses Jetpack (AndroidX), which includes meeting these version requirements:
com.android.tools.build:gradle
v7.3.0 or latercompileSdkVersion
33
Kotlin 1.7.10 or higher
iOS:
iOS 13
Swift 5.0
Sign into Adrop using your email or Google account.
Step 1: Create an Adrop project
Before you can add Adrop to your React Native app, you need to create an Adrop project to connect to your app.
Step 2: Register your app with Adrop
To use Adrop in your React Native app, you need to register your app with your Adrop project. Registering your app is often called "adding" your app to your project.
Make sure to enter the package name that your app is actually using. The package name value is case-sensitive, and it cannot be changed for this Adrop Android app after it's registered with your Adrop project.
Step 3: Add an Adrop configuration file
Download adrop_service.json to obtain your Adrop Android platforms config file.
Step 4: Add Adrop library to your app
From your React Native project directory, run the following command to install the plugin.
Altering CocoaPods to use frameworks
Open the file ./ios/Podfile
and add this line inside your targets
adrop-ads-react-native uses use_frameworks
, which has compatibility issues with Flipper.
Flipper: use_frameworks
is not compatible with Flipper. You need to disable Flipper by commenting out the :flipper_configuration
line in your Podfile.
Autolinking & rebuilding
Once the above steps have been completed, the React Native Adrop library must be linked to your project and your application needs to be rebuilt.
Users on React Native 0.60+ automatically have access to "autolinking", requiring no further manual installation steps. To automatically link the package, rebuild your project:
Step 5: Initialize Adrop in your app
The final step is to add initialization code to your application.
Import the Adrop library and initialize.
Add AdropNavigatorObserver to measure the frequency of ad impressions if you use @react-navigation
Next Steps
You're all set! Please register an Ad unit to show ads to users.
Learn how to Create your Ad unit.
(Optional) Troubleshooting
Last updated