Skip to main content

Overview

Backfill ads is a feature that automatically displays alternative ads when no direct ads are available, maximizing your revenue. Adrop supports major ad networks like AdMob and Pangle as backfill ad sources.
To use backfill ads, you need to install an additional dependency: io.adrop:adrop-ads-backfill

Installation

1. Gradle Configuration

Settings.gradle.kts

Add the Pangle ad network repository:
settings.gradle.kts
dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
    repositories {
        google()
        mavenCentral()
        maven { url = uri("https://artifact.bytedance.com/repository/pangle") }
    }
}

Build.gradle.kts

Add the backfill ads dependency:
dependencies {
    implementation("io.adrop:adrop-ads:1.7.3")
    implementation("io.adrop:adrop-ads-backfill:1.7.3")
}

2. AndroidManifest.xml Configuration

If using AdMob as a backfill ad source, add the APPLICATION_ID to AndroidManifest.xml:
AndroidManifest.xml
<manifest>
    <application>
        <!-- AdMob App ID -->
        <meta-data
            android:name="com.google.android.gms.ads.APPLICATION_ID"
            android:value="ca-app-pub-xxxxxxxxxxxxxxxx~yyyyyyyyyy"/>
    </application>
</manifest>
Replace ca-app-pub-xxxxxxxxxxxxxxxx~yyyyyyyyyy with your actual AdMob App ID.

Console Configuration

Enable backfill ads in the Adrop console:
  1. Log in to the Adrop Console
  2. Navigate to the Ad Units menu
  3. Select the ad unit where you want to use backfill ads
  4. Enable backfill ads in the Backfill Settings section
  5. Select the backfill ad network to use (AdMob, Pangle, etc.)
  6. Enter the network-specific settings (e.g., AdMob Ad Unit ID)

Ad Display Flow

Backfill ads are displayed in the following order:

Supported Ad Formats

Backfill ads support the following formats:
Ad FormatSupportDescription
Banner✅ SupportedFixed-size banner ads
Native✅ SupportedCustomizable native ads
Interstitial✅ SupportedFull-screen ads
Rewarded✅ SupportedRewarded ads

Checking for Backfill Ads

To check if an ad is a backfill ad, use the isBackfilled property:
AdropBanner(context, "YOUR_UNIT_ID").apply {
    listener = object : AdropAdListener() {
        override fun onAdReceived(ad: AdropAd) {
            if (ad.isBackfilled) {
                Log.d("Adrop", "Backfill ad loaded")
            } else {
                Log.d("Adrop", "Direct ad loaded")
            }
        }
    }
    load()
}

UMP (User Messaging Platform) Integration

Backfill SDK supports GDPR and CCPA compliance through Google UMP. Use the Consent Manager to request user consent.

Basic Usage

import io.adrop.ads.Adrop
import io.adrop.ads.consent.AdropConsentListener
import io.adrop.ads.consent.AdropConsentResult

class MainActivity : AppCompatActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)

        // Call after Adrop.initialize()
        Adrop.consentManager?.requestConsentInfoUpdate(this, object : AdropConsentListener {
            override fun onConsentInfoUpdated(result: AdropConsentResult) {
                if (result.error != null) {
                    Log.e("Consent", "Error: ${result.error}")
                }
            }
        })
    }
}
StatusDescription
UNKNOWNConsent status not yet determined
REQUIREDConsent required (popup will be shown)
NOT_REQUIREDConsent not required (non-GDPR region)
OBTAINEDConsent already obtained

Debug Settings (Test Mode)

Test GDPR/CCPA consent flows during development:
import io.adrop.ads.consent.AdropConsentDebugGeography

if (BuildConfig.DEBUG) {
    // Set debug geography before requesting consent
    Adrop.consentManager?.setDebugSettings(
        testDeviceHashedIds = listOf("YOUR_HASHED_DEVICE_ID"),  // Check Logcat
        geography = AdropConsentDebugGeography.EEA  // Test GDPR
    )

    // Reset consent for testing
    Adrop.consentManager?.reset(this)
}
GeographyDescription
DISABLEDUse actual device location
EEATest GDPR (European Economic Area)
REGULATED_US_STATETest CCPA (California, etc.)
OTHERTest non-regulated regions

AdSense Ads in WebView

Display AdSense ads in your WebView by registering it with the Adrop SDK.

AndroidManifest.xml Configuration

Add the following to your AndroidManifest.xml to enable AdSense in WebView:
AndroidManifest.xml
<manifest>
    <application>
        <!-- AdSense WebView Integration -->
        <meta-data
            android:name="com.google.android.gms.ads.INTEGRATION_MANAGER"
            android:value="webview"/>
    </application>
</manifest>
This configuration is required for AdSense ads to work properly in WebView. Without it, AdSense ads may not display.

Register WebView

import android.webkit.WebView
import io.adrop.ads.Adrop

class WebViewActivity : AppCompatActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)

        val webView = findViewById<WebView>(R.id.webView)

        // Register WebView for AdSense support
        // Call as early as possible, before loading content
        Adrop.registerWebView(webView)

        // Load your web content
        webView.loadUrl("https://your-website.com")
    }
}
registerWebView() automatically configures optimal WebView settings:
  • JavaScript enabled
  • DOM storage enabled
  • Media playback without user gesture
  • Third-party cookies enabled
Call this method on the main thread, as early as possible (e.g., in onCreate).
AdSense in WebView requires adrop-ads-backfill module. If the module is not installed, registerWebView() is silently ignored.

Best Practices

Enable Backfill Ads

Enable backfill ads on all ad units to maximize ad fill rate and revenue.

Set Appropriate Timeouts

Set appropriate timeouts for direct ads and backfill ads to improve user experience.

Analyze Backfill Ads

Use the isBackfilled property to track and analyze the ratio of direct ads to backfill ads.

Optimize Ad Networks

Test multiple backfill ad networks and select the one that provides the highest revenue.

Important Notes

  • To use backfill ads, you must add the io.adrop:adrop-ads-backfill dependency.
  • If using AdMob, you must add the APPLICATION_ID to AndroidManifest.xml.
  • For GDPR/CCPA compliance, implement UMP consent flow before loading ads.
  • You must comply with the policies of the backfill ad networks.