Skip to main content

Native Ad Format

Native ads provide individual ad components that you implement directly in your app’s layout, unlike other formats where the SDK provides the complete ad view. Advantages: Customize the layout to match your UI/UX and minimize visual disruption. Requirements: Include an ad indicator and maintain visual differentiation to prevent users from confusing ads with content. Native Example Elements En Pn
Four Required Elements for Native AdsNative ads can be designed to complement the content and look of your app. However, the following four required elements must be included. These elements are necessary to clearly mark native ads as advertisements so that users don’t mistake them for content, and to ensure the minimum advertising effectiveness expected by advertisers.
  1. Ad attribution: You must clearly display ad attribution text such as “Ad”, “Advertisement”, or “Sponsored” (localized appropriately) in the ad area so users can clearly identify the content as advertising.
  2. AdChoices icon: The AdChoices overlay icon enables users to identify and control ads, typically displayed as an ’ⓘ’ icon. This icon is automatically added by the DARO SDK, so no separate implementation is required. However, it’s important that the AdChoices overlay be easily seen, so design your ad view to ensure the icon is not obscured by other UI elements. The icon’s appearance and behavior may vary depending on the ad source (demand).
  3. Title: The ad title must be displayed.
  4. CTA (Call to action): A CTA button with text such as “Install”, “Open”, or “Download” must be included. The size and format of the button can be freely configured, and it can be replaced with a text field depending on the situation. Since the ad source (demand) provides the CTA text, there is no need to specify fixed wording.

Integrating Ads

  • Xml
  • Compose
1

Create adBinder

  • Create an adBinder needed to render native ads.
  • Manual implementation(xml)
  • Use Template
val adBinder = DaroNativeAdBinder.Builder(context, ${layoutId})
  .setIconViewId(${iconViewId})
  .setBodyTextViewId(${bodyViewId})
  .setCallToActionViewId(${callToActionViewId})
  .setMediaViewGroupId(${mediaViewGroupId})
  .setTitleViewId(${titleViewId})
  .build()
2

Create adUnit

  val adUnit = DaroNativeAdUnit(
    key = ${AdUnitId},
    placement = ${placement}, //Name displayed in logs. Can be left empty.
  )
3

Create adView and add to view

val adView = DaroNativeAdView(
  context = context,
  adUnit = adUnit
)

binding.adViewContainer.addView(adView)
4

Set adBinder on adView

adView.setAdBinder(adBinder)
5

Set listener

adView.setListener(object : DaroAdViewListener {
  override fun onAdImpression(adInfo: DaroAdInfo) {}
  override fun onAdClicked(adInfo: DaroAdInfo) {}
  override fun onAdLoadSuccess(ad: DaroViewAd, adInfo: DaroAdInfo) {}
  override fun onAdLoadFail(err: DaroAdLoadError) {}
})
6

Load ad

adView.loadAd()
You must set adBinder before calling loadAd().
  • When you declare a view, it automatically detects the appropriate lifecycle for the screen and manages its behavior. You don’t need to manually call resume, pause, or destroy.
  • If you set autoDetectLifecycle to false (default: true), you must manually call resume, pause, and destroy.
You can preload ads without creating an ad view using the DaroNativeAdView.requestPreload() method.
DaroNativeAdView.requestPreload(
  this,
  DaroNativeAdUnit(
    key = ${AdUnitId},
    placement = ${placement},
  )
)
To use the preloaded ad immediately, both the AdUnitId and placement of the DaroNativeAdUnit used in the view must match.

Template

  • The Daro SDK provides the following templates.