Native integration

This page explains how to integrate a Teads native placement into your Android application.



The article is using the native test PID 124859. This PID is meant for testing purpose and shall not be released into production.

Please retrieve your production PID from your local account manager.

Add the NativeAdView view to your layout

<?xml version="1.0" encoding="utf-8"?>



Native Elements

The native ad supports these following elements within the NativeAdView container:

  • R.id.teads_native_title (TextView)
  • R.id.teads_native_content (TextView)
  • R.id.teads_native_media (MediaView)
  • R.id.teads_native_icon (ImageView)
  • R.id.teads_native_advertiser (TextView)
  • R.id.teads_native_call_to_action (Button)
  • R.id.teads_native_star_rating (View)
  • R.id.teads_native_price (TextView)

Load an Ad

class MainActivity : AppCompatActivity(), NativeAdPlacementListener, NativeAdListener { 
  private lateinit var adPlacement: NativeAdPlacement

  private lateinit var inFeedBasicBinding: ActivityInFeedBasicBinding

  override fun onCreate(savedInstanceState: Bundle) { 
    inFeedBasicBinding = ActivityInFeedBasicBinding.inflate(layoutInflater)

    val placementSettings = AdPlacementSettings.Builder().build()
    val requestSettings = AdRequestSettings.Builder().build()

    adPlacement = TeadsSDK.createNativePlacement(applicationContext, 124859, placementSettings)
    adPlacement.requestAd(requestSettings, this)

  override fun onAdReceived(nativeAd: NativeAd) {

  override fun onFailToReceiveAd(error: String) {}

  override fun adOpportunityTrackerView(trackerView: AdOpportunityTrackerView) {

Event monitoring

The Teads inApp SDK provides a set of listeners to let you monitor a large scope of events all along ad life cycle. This helps tailor the ad experience in your app, e.g., closing the ad view in case of onAdError.

interface NativeAdPlacementListener {
  // This is the entry point of an Ad correctly loaded by Teads
  fun onAdReceived(nativeAd: NativeAd)
  // When Teads inApp SDK has failed to retrieve an ad
  fun onFailToReceiveAd(failReason: String)
  // This is the monitoring slot tracker view (see Slot Monitoring section below)
  fun adOpportunityTrackerView(trackerView: AdOpportunityTrackerView)
interface NativeAdListener {
  // When an impression has occured
  fun onAdImpression(nativeAd: NativeAd)
  // When an event click has been fired
  fun onAdClicked(nativeAd: NativeAd)
  // When the ad experience has experienced an issue
  fun onAdError(nativeAd: NativeAd, code: Int, description: String)
  // When the ad has been closed
  fun onAdClose(nativeAd: NativeAd)

Check list

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

Additional Settings

Find the full available AdPlacementSettings and AdRequestSettings settings here:

  // To enable debug logginer for Teads inApp SDK
  // This is the CCPA string 
  // Here is the GDPR informations
  .userConsent([SUBJECT_TO_GDPR], [CONSENT_STRING], TCFVersion.V1, sdkId)
  // this turn on the validation tool to validate your integration

Did you find it helpful? Yes No

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