Smart AdServer mediation - Native Ad
- Latest Version: android release notes
- Sample App: Teads android Sample App
This article shows you how to deliver Teads native ads on your application using the Smart Ad Server Mediation adapter.
Sample App on GitHub Teads inApp SDK Android sample App
Prerequisites
- Import the Teads inApp SDK in your project.
- SmartCoreSdk: 7.14.0+
- SmartDisplaySdk: 7.14.0+
- AndroidX (⚠️ SmartSDK mandatory)
Installation
Before installing the Teads Smart adapter, you will need to integrate Smart SDK into your application.
Gradle
project/build.gradle
allprojects {
  repositories {
    ...
    maven { url  "https://teads.jfrog.io/artifactory/SDKAndroid-maven-prod" }
    maven { url 'https://packagecloud.io/smartadserver/android/maven2' }
  }
}
app/build.gradle
dependencies {
  ...
  implementation 'com.smartadserver.android:smart-core-sdk:7.14.0@aar'
  implementation ("com.smartadserver.android:smart-display-sdk:7.14.0@aar") {
    transitive = true
  }
  // Teads inApp SDK
  implementation("tv.teads.sdk.android:sdk:6.x.x@aar") {
    transitive = true
  }
  // Teads Smart Adapter
  implementation 'tv.teads.sdk.android:smartadapter:6.x.x'
}
Defining a Custom Event
In order to display a Teads ad using Smart, you need to create a custom event.
| Name | Value | 
|---|---|
| SDK Name | TeadsSDK | 
| Ad Format Type | Banner | 
| Adapter Class | tv.teads.adapter.smart.SmartAdapter | 
| Placement Info | { "placementId": #PID#, "teadsAdSettingsKey": "[sas_kw | teadsAdSettingsKey]" } | 
Please retrieve your production PID from your local account manager.
See this page for test PIDs and creative formats.
Important
Don't forget to replace the #PID# with your Teads placement ID.
Display an ad
Create your TeadsMediationSettings and add it to the SASAdPlacement.
val settings = TeadsMediationSettings.Builder()
                 .build()
val placement = SASAdPlacement(
                        siteID,
                        pageName,
                        formatID,
                        SmartHelper.getTargetFromTeadsAdSettings(settings),
                        supplyChainObjectString
                      )
val nativeAdManager = SASNativeAdManager(context, adPlacement)
Then, your SASNativeAdManager is ready to request a native ad, so you want to register
the proper listener and use our ViewBinder inside it.
Then you can use loadNativeAd()
nativeAdManager.nativeAdListener = object : SASNativeAdManager.NativeAdListener {
                        override fun onNativeAdLoaded(nativeAd: SASNativeAdElement) {
                            TeadsSmartViewBinder(context!!, [YOUR_LAYOUT_TO_INFLATE], nativeAd)
                                .title(R.id.ad_title)
                                .body(R.id.ad_body)
                                .iconImage(R.id.teads_icon)
                                .callToAction(R.id.teads_cta)
                                .mediaLayout(R.id.teads_mediaview)
                                .adChoice(R.id.ad_choice)
                                .bind()
                        }
                        override fun onNativeAdFailedToLoad(e: Exception) {
                            // the native ad loading failed
                        }
                    }
nativeAdManager.loadNativeAd()
Mediation settings
Find the full settings list in the Integration Guide and Settings Configuration
Check list
- ✅ Ensure Brand Safety is enabled
- ✅ Ensure you comply with privacy legal requirements (GDPR/CCPA/GPP)
- ✅ Comply with app-ads.txt
- ✅ Enable validation mode to ensure key features are working