Native Ad - Classic integration

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

  1. Prerequisites
  2. Implementation
  3. Event monitoring
  4. Check list
  5. Additional Settings




Make sure you are using a dedicated native placement id (PID) on native ad requests, do not reuse inRead PID. You will not receive any ad if the PID is not a native one.

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) (Guaranteed in every request)
  • R.id.teads_native_content (TextView)
  • R.id.teads_native_media (MediaView) (Guaranteed in every request)
  • 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(), 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) {

    with (inFeedBasicBinding.containerAdView) {
        nativeAdView.teadNativeMedia.mediaScale = MediaScale.CENTER_CROP // Set it as CENTER_CROP (default) or CENTER_INSIDE

  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 NativeAdListener {
  // When an impression has occurred
  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)

  // 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)

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 logger for Teads inApp SDK
  // This is the CCPA string
  // Here is the GDPR information
  .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.