Overview
Use the Adrop Android SDK to display various ad formats in your app.Supported Ad Formats
| Format | Description |
|---|---|
| Banner | Rectangular ads displayed in a portion of the screen |
| Native | Customizable ads that match your app’s UI |
| Interstitial | Full-screen ads |
| Rewarded | Video ads that reward users upon completion |
| Popup | Ads displayed as popups at specific moments |
| Splash | Ads displayed with your logo at app launch |
Requirements
- Android 6.0 (API Level 23) or higher
- Gradle 7.6.3 or higher
- Kotlin 2.1.0 or higher
- compileSdkVersion 34 or higher
- Jetpack (AndroidX) support
Prerequisites
1. Add adrop_service.json File
1
Download File
Download the
adrop_service.json file from Ad Control Console > Admin > App.2
Add to Project
Place the downloaded file in the
app/src/main/assets/ folder.2. Get Unit ID
Find the unit ID for your ad placement in the Ad Unit tab of the console.Installation
Gradle Setup
Add the dependency to your app-levelbuild.gradle or build.gradle.kts file.
Check the latest version on Maven Central.
Initialization
Initialize the SDK in theonCreate() method of your MainActivity.
Initialization Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
context | Application | - | App’s Application instance (required) |
production | Boolean | false | Production mode. Set to true for release |
targetCountries | Array<String> | [] | Target country codes (ISO 3166 alpha-2) |
User Settings
Set UID
Set a user identifier for targeted advertising.Set the UID before entering the ad placement for targeted ads to work properly.
Set Theme
Set the theme for ads that support dark mode. Must be called afterinitialize().
AUTO mode automatically detects the system dark mode setting. When the theme changes, the splash ad cache is automatically cleared.Deep Link Handling
Handle deep links when the app is launched via an external link.Test Unit IDs
Use test unit IDs during development. Replace with real unit IDs before production release.Banner Ads
| Format | Test Unit ID |
|---|---|
| Banner (320x50) | PUBLIC_TEST_UNIT_ID_320_50 |
| Banner (320x100) | PUBLIC_TEST_UNIT_ID_320_100 |
| Carousel Banner | PUBLIC_TEST_UNIT_ID_CAROUSEL |
| Banner Video (16:9) | PUBLIC_TEST_UNIT_ID_BANNER_VIDEO_16_9 |
| Banner Video (9:16) | PUBLIC_TEST_UNIT_ID_BANNER_VIDEO_9_16 |
Native Ads
| Format | Test Unit ID |
|---|---|
| Native (Image) | PUBLIC_TEST_UNIT_ID_NATIVE |
| Native Video (16:9) | PUBLIC_TEST_UNIT_ID_NATIVE_VIDEO_16_9 |
| Native Video (9:16) | PUBLIC_TEST_UNIT_ID_NATIVE_VIDEO_9_16 |
Interstitial/Rewarded Ads
| Format | Test Unit ID |
|---|---|
| Interstitial | PUBLIC_TEST_UNIT_ID_INTERSTITIAL |
| Rewarded | PUBLIC_TEST_UNIT_ID_REWARDED |
Popup Ads
| Format | Test Unit ID |
|---|---|
| Popup (Bottom) | PUBLIC_TEST_UNIT_ID_POPUP_BOTTOM |
| Popup (Center) | PUBLIC_TEST_UNIT_ID_POPUP_CENTER |
| Popup Video Bottom (16:9) | PUBLIC_TEST_UNIT_ID_POPUP_BOTTOM_VIDEO_16_9 |
| Popup Video Bottom (9:16) | PUBLIC_TEST_UNIT_ID_POPUP_BOTTOM_VIDEO_9_16 |
| Popup Video Center (16:9) | PUBLIC_TEST_UNIT_ID_POPUP_CENTER_VIDEO_16_9 |
| Popup Video Center (9:16) | PUBLIC_TEST_UNIT_ID_POPUP_CENTER_VIDEO_9_16 |
Splash Ads
| Format | Test Unit ID |
|---|---|
| Splash | PUBLIC_TEST_UNIT_ID_SPLASH |
Error Codes
Common error codes returned when ad loading fails.| Error Code | Description |
|---|---|
ERROR_CODE_AD_NO_FILL | No ads available |
ERROR_CODE_NETWORK | Network connection failed |
ERROR_CODE_INVALID_UNIT | Invalid unit ID |
ERROR_CODE_INITIALIZE | SDK initialization required |
ERROR_CODE_AD_LOADING | Ad is loading (duplicate request) |
ERROR_CODE_AD_SHOWN | Ad is already displayed |
Table of Contents
Banner Ads
Implement banner ads
Native Ads
Implement native ads
Interstitial Ads
Implement interstitial ads
Rewarded Ads
Implement rewarded ads
Popup Ads
Implement popup ads
Splash Ads
Implement splash ads
Backfill Ads
Set up backfill ads
Targeting
User properties and context targeting
Reference
Classes, listeners, and error codes
Examples
Example repository