Overview
The Adrop React Native SDK allows you to easily integrate various ad formats into your React Native app.Supported Ad Formats
| Format | Description |
|---|---|
| Banner Ads | Rectangular ads displayed in a portion of the screen |
| Native Ads | Ads that blend naturally with app content |
| Interstitial Ads | Full-screen ads |
| Rewarded Ads | Full-screen ads that provide rewards |
| Popup Ads | Ads displayed in popup format |
Requirements
React Native
- React Native 0.71 or higher
Android
- API level 23 (Android 6.0) or higher
compileSdkVersion34- Kotlin 2.1.0 or higher
- Gradle 7.6.3 or higher
iOS
- iOS 13.0 or higher
- Swift 5.0 or higher
Installation
1. Install Package
2. Android Setup
Add the Kotlin plugin toandroid/app/build.gradle.
android/app/build.gradle
3. iOS Setup
Modifyios/Podfile.
ios/Podfile
Initialization
Initialize the SDK when your app starts. This is typically done inApp.tsx or index.js.
App.tsx
Initialization Options
| Parameter | Type | Required | Description |
|---|---|---|---|
production | boolean | Y | true: production mode, false: test mode |
targetCountries | string[] | N | Country codes to display ads (e.g., ['KR', 'US']) |
useInAppBrowser | boolean | N | Whether to use in-app browser on iOS (default: false) |
Theme Settings
Set the UI theme for ads.| Theme | Description |
|---|---|
AdropTheme.auto | Automatically switch based on system settings |
AdropTheme.light | Light mode |
AdropTheme.dark | Dark mode |
User Identifier Settings
Set the user identifier (UID) for targeted advertising.Test Unit IDs
Use the following test unit IDs during development and testing.| Format | Test Unit ID |
|---|---|
| Banner (320x50) | PUBLIC_TEST_UNIT_ID_320_50 |
| Banner (320x100) | PUBLIC_TEST_UNIT_ID_320_100 |
| Native | PUBLIC_TEST_UNIT_ID_NATIVE |
| Interstitial | PUBLIC_TEST_UNIT_ID_INTERSTITIAL |
| Rewarded | PUBLIC_TEST_UNIT_ID_REWARDED |
| Popup | PUBLIC_TEST_UNIT_ID_POPUP |
Error Codes
Error codes that may occur in the SDK.| Error Code | Description |
|---|---|
ERROR_CODE_NETWORK | Network error |
ERROR_CODE_INTERNAL | Internal error |
ERROR_CODE_INITIALIZE | SDK initialization error |
ERROR_CODE_INVALID_UNIT | Invalid unit ID |
ERROR_CODE_NOT_TARGET_COUNTRY | Not a target country |
ERROR_CODE_AD_INACTIVE | Inactive ad |
ERROR_CODE_AD_NO_FILL | No ads to display |
ERROR_CODE_AD_LOAD_DUPLICATED | Duplicate load request |
ERROR_CODE_AD_LOADING | Loading in progress |
ERROR_CODE_AD_EMPTY | Empty ad |
ERROR_CODE_AD_SHOWN | Ad already shown |
ERROR_CODE_AD_HIDE_FOR_TODAY | Ad hidden for today |
ERROR_CODE_LANDSCAPE_UNSUPPORTED | Landscape mode not supported |
Troubleshooting
iOS Build Error
If you encounter Swift version compatibility issues, add the following to thepost_install block in ios/Podfile.
ios/Podfile
Android Build Error
If the Kotlin version doesn’t match, check the Kotlin version inandroid/build.gradle.
android/build.gradle