Google Ad Manager and AdMob mediation - Native Ad

  1. Prerequisites
  2. Installation
  3. Defining a Custom Event
  4. Display an ad
  5. Mediation settings
  6. Check list



Before installing the Teads AdMob adapter, you will need to integrate GoogleMobileAds SDK into your application.



allprojects {
  repositories {
    maven { url  "https://teads.jfrog.io/artifactory/SDKAndroid-maven-prod" }


dependencies {
  implementation 'com.google.android.gms:play-services-ads:22.6.0' // or higher

  // Teads inApp SDK
  implementation("tv.teads.sdk.android:sdk:5.x.x@aar") {
      transitive = true

  // Teads Admob Adapter
  implementation 'tv.teads.sdk.android:admobadapter:5.x.x'

Defining a Custom Event

In order to display a Teads ad using AdMob or Google Ad Manager mediation,
you need to create a custom event.


Follow the custom event documentation on the AdMob dashboard using the below values.

Name Value
Class Name tv.teads.adapter.admob.nativead.TeadsNativeAdapter
Parameter Teads placement ID (PID)

Follow the custom event documentation on Google Ad Manager using the below values.

Name Value
Class Name tv.teads.adapter.admob.nativead.TeadsNativeAdapter
Parameter Teads placement ID (PID)

Please retrieve your production PID from your local account manager.

See this page for test PIDs and creative formats.

Display an ad

Create your custom layout

Create a new layout for an ad item with the AdMob container NativeAdView





Native Ad Elements

  • headlineView (Guaranteed in every request)
  • mediaView (Guaranteed in every request)
  • bodyView
  • callToActionView
  • iconView
  • priceView
  • starRatingView
  • storeView
  • advertiserView

Request an ad

Create the AdLoader

You need to inflate your previously created XML view using LayoutInflater


val adLoader = AdLoader.Builder(this, ADMOB_TEADS_NATIVE_ID)
                .forNativeAd { ad: NativeAd ->
                    adView = layoutInflater.inflate(R.layout.layout_admob_native, null) as NativeAdView
                    populateUnifiedNativeAdView(ad, adView)
                .withAdListener(object : AdListener() {
                    // can subscribe to other ad experience events
                    override fun onAdFailedToLoad(error: LoadAdError) {}

Load an ad

Create the TeadsMediationSettings, then add the settings to the AdRequest using toBundle() method

val settings = TeadsMediationSettings.Builder()

val adRequest = AdRequest.Builder()
                    .addNetworkExtrasBundle(TeadsNativeAdapter::class.java, settings.toBundle())


Populate the ad

We can then populate and customize our NativeAdView according the data we have received

private fun populateUnifiedNativeAdView(nativeAd: NativeAd, adView: NativeAdView) {
  // Set the media view. Media content will be automatically populated in the media view once
  // adView.setNativeAd() is called.
  val mediaView: MediaView = adView.findViewById(R.id.ad_media)

  adView.mediaView = mediaView
  adView.headlineView = adView.findViewById(R.id.ad_headline)

  // The headline is guaranteed to be in every UnifiedNativeAd.
  (adView.headlineView as TextView).text = nativeAd.headline

  // every other assets aren't guaranteed to be in every UnifiedNativeAd, so it's important to
  // check before trying to display them

  // Add the NativeAdView to your main layout inside your container

Mediation settings

Find the full settings list here

Check list

  • ✅ Ensure Brand Safety is enabled
  • ✅ Ensure you comply with privacy legal requirements (GDPR/CCPA).
  • ✅ Comply with app-ads.txt
  • ✅ Enable ad view resizing
  • ✅ Test different test PIDs for multiple ad format and size testing
  • ✅ Enable validation mode to ensure key features are working

Did you find it helpful? Yes No

Send feedback
Sorry we couldn't be helpful. Help us improve this article with your feedback.