Login
Welcome
Login

inRead - Google Ad Manager and AdMob mediation


Prerequisites

Installation

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

Gradle

project/build.gradle

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

app/build.gradle

dependencies {
   ...
    implementation 'com.google.android.gms:play-services-ads:20.2.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.

Admob

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

Name Value
Class Name tv.teads.adapter.admob.TeadsAdapter
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.TeadsAdapter
Parameter Teads placement ID (PID)

Please retrieve your production PID from your local account manager.

See this page for test PIDs and creative formats.

Ad Resizing

The code below must be implemented to enable the resizing of the mediated ad slot making possible the rendering of square and vertical creatives.

Initialize the TeadsHelper first.

TeadsHelper.initialize()

You can instantiate a new listener as below, the listener needs to be a class member field or strong referenced somewhere,
we keep internally a weak reference to it, so it goes garbage collected when you don't need it anymore:

listener = object : TeadsAdapterListener {
            override fun onRatioUpdated(adRatio: AdRatio) {
              val params: ViewGroup.LayoutParams = adView.layoutParams

              // Here the width is MATCH_PARENT
              params.height = adRatio.calculateHeight(adView.measuredWidth)
              adView.layoutParams = params
            }

            override fun adOpportunityTrackerView(trackerView: AdOpportunityTrackerView) {
          }
        }

Use the helper to attach a listener, it will return you an UNIQUE key to reference the current listener attached.

val key = TeadsHelper.attachListener(listener)

Finally, add it to your current ad settings for the specific ad request

val settings = TeadsMediationSettings.Builder()
                 .addAdapterListener(key)
                 .build()

val adRequest = AdRequest.Builder()
                .addCustomEventExtrasBundle(TeadsAdapter::class.java, settings.toBundle())
                .build()

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.