Skip to main content

Overview

Use the Adrop Android SDK to display various ad formats in your app.

Supported Ad Formats

FormatDescription
BannerRectangular ads displayed in a portion of the screen
NativeCustomizable ads that match your app’s UI
InterstitialFull-screen ads
RewardedVideo ads that reward users upon completion
PopupAds displayed as popups at specific moments
SplashAds 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.
app/
└── src/
    └── main/
        └── assets/
            └── adrop_service.json
The SDK will not work properly without the adrop_service.json file.

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-level build.gradle or build.gradle.kts file.
dependencies {
    implementation("io.adrop:adrop-ads:1.7.2")
}
Check the latest version on Maven Central.

Initialization

Initialize the SDK in the onCreate() method of your MainActivity.
import io.adrop.ads.Adrop
import io.adrop.ads.model.AdropTheme

class MainActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)

        // Initialize SDK
        Adrop.initialize(application, production = false)
        Adrop.setTheme(AdropTheme.AUTO)
    }
}

Initialization Parameters

ParameterTypeDefaultDescription
contextApplication-App’s Application instance (required)
productionBooleanfalseProduction mode. Set to true for release
targetCountriesArray<String>[]Target country codes (ISO 3166 alpha-2)
Make sure to set production = true before release. Ads will not be displayed if set to false in production.

User Settings

Set UID

Set a user identifier for targeted advertising.
Adrop.setUID("user_123")
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 after initialize().
// Light mode
Adrop.setTheme(AdropTheme.LIGHT)

// Dark mode
Adrop.setTheme(AdropTheme.DARK)

// Follow system setting (recommended)
Adrop.setTheme(AdropTheme.AUTO)
AUTO mode automatically detects the system dark mode setting. When the theme changes, the splash ad cache is automatically cleared.

Handle deep links when the app is launched via an external link.
override fun onNewIntent(intent: Intent?) {
    super.onNewIntent(intent)
    intent?.let { Adrop.handleDeepLink(it) }
}

Test Unit IDs

Use test unit IDs during development. Replace with real unit IDs before production release.
FormatTest Unit ID
Banner (320x50)PUBLIC_TEST_UNIT_ID_320_50
Banner (320x100)PUBLIC_TEST_UNIT_ID_320_100
Carousel BannerPUBLIC_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

FormatTest 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

FormatTest Unit ID
InterstitialPUBLIC_TEST_UNIT_ID_INTERSTITIAL
RewardedPUBLIC_TEST_UNIT_ID_REWARDED
FormatTest 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

FormatTest Unit ID
SplashPUBLIC_TEST_UNIT_ID_SPLASH

Error Codes

Common error codes returned when ad loading fails.
Error CodeDescription
ERROR_CODE_AD_NO_FILLNo ads available
ERROR_CODE_NETWORKNetwork connection failed
ERROR_CODE_INVALID_UNITInvalid unit ID
ERROR_CODE_INITIALIZESDK initialization required
ERROR_CODE_AD_LOADINGAd is loading (duplicate request)
ERROR_CODE_AD_SHOWNAd is already displayed
For more error codes, see the Reference.

Table of Contents