Overview
Native ads are an ad format that allows you to freely customize the ad UI to match your app’s design. You can provide a natural user experience by individually placing elements such as ad creatives (images, videos), headline, body, and CTA buttons.Key Features
- Complete UI Customization: Freely configure ad layout to match your app’s design system
- Various Media Support: Image and video ad creative support
- Flexible Click Area Settings: Full click or individual element click handling
- Profile Information Display: Advertiser profile logo, name, and link support
Classes and Interfaces
AdropNativeAd
Main class for loading and managing native ads.Ad unit ID (issued from console)
ID for contextual targeting (optional)
Listener to handle ad events
Whether to use custom click handling
Key Properties
| Property | Type | Description |
|---|---|---|
headline | String | Ad headline |
body | String | Ad body text |
icon | String | Icon image URL |
cover | String | Cover image URL |
advertiser | String | Deprecated. Use profile.displayName instead. |
advertiserURL | String | Deprecated. Use profile.link instead. |
accountTag | JSONObject | Deprecated. No longer supported. |
creativeTag | JSONObject | Deprecated. No longer supported. |
callToAction | String | Call-to-action text (e.g., “Learn More”) |
profile | AdropNativeAdProfile | Advertiser profile information |
isLoaded | Boolean | Whether ad loading is complete |
isDestroyed | Boolean | Whether ad is destroyed |
AdropNativeAdView
Container view for displaying native ads.Whether to enable entire area click. When set to
true, click events occur on the entire ad view area.Key Methods
| Method | Description |
|---|---|
setIconView(view, listener) | Set icon image view (ImageView type) |
setHeadLineView(view, listener) | Set headline text view (TextView type) |
setBodyView(view) | Set body text view (TextView type) |
setMediaView(view) | Set media container view (AdropMediaView type) |
setAdvertiserView(view, listener) | Set advertiser text view (TextView type) |
setCallToActionView(view) | Set CTA button or text view |
setProfileLogoView(view, listener) | Set profile logo image view (ImageView type) |
setProfileNameView(view, listener) | Set profile name text view (TextView type) |
setNativeAd(ad) | Bind ad data to view |
destroy() | Release resources |
AdropMediaView
Media container view for displaying ad images or videos.AdropNativeAdListener
Interface for handling ad events.AdropNativeAdProfile
Data class containing advertiser profile information.| Property | Type | Description |
|---|---|---|
displayLogo | String | Profile logo image URL |
displayName | String | Profile display name |
link | String | Profile link URL |
Implementation Guide
1. XML Layout Setup
Define the layout to display native ads. UseAdropNativeAdView as the root and place ad elements inside.
res/layout/native_ad_layout.xml
2. Load and Display Ad (Kotlin)
3. Load and Display Ad (Java)
Java
Advanced Features
Entire Click Area Setting
You can set the entire ad view area to trigger click events.When
isEntireClick is set to true, the entire ad view becomes a clickable area. Individual element click listeners will not work.Individual Element Click Listeners
You can set custom click listeners on specific ad elements.Contextual Targeting
You can request ads matching a specific context.Using in RecyclerView
You can display native ads as items in a RecyclerView.RecyclerView Adapter
Test Unit IDs
Use the following test unit IDs during development and testing.| Format | Test Unit ID |
|---|---|
| Native (Image) | PUBLIC_TEST_UNIT_ID_NATIVE |
| Native Video (16:9) | PUBLIC_TEST_UNIT_ID_NATIVE_VIDEO_16_9 |
| Native Video (9:16) | PUBLIC_TEST_UNIT_ID_NATIVE_VIDEO_9_16 |
Lifecycle Management
Resource Release in Activity/Fragment
Native ads must be released when no longer in use to prevent memory leaks.Resource Release in RecyclerView
When using ads in a RecyclerView Adapter, all ads must be released when the Activity or Fragment is destroyed.Video Tracking and VTR
Adrop measures video metrics for native creatives — including impression-to-completion (VTR),onAdVideoStart, and onAdVideoEnd — only when the video is rendered through the SDK’s media surface (AdropMediaView bound via AdropNativeAdView.setMediaView(...)).
The AdropNativeAd.asset property returns a URL pointing to the underlying image or video file. It is exposed as supplementary metadata (for example, for thumbnails or your own analytics); it is not intended to drive playback.
Recommended pattern
Bind the SDK media surface for every video native:If a placement absolutely requires a custom player and you accept that VTR will not be measured, you can still surface click and impression attribution by keeping the ad bound to
AdropNativeAdView. In that case, treat the placement as non-VTR inventory in your internal reporting and avoid mixing it with SDK-measured video performance.Best Practices
1. Display Only Required Elements
You don’t need to display all ad elements. Selectively use only the elements needed to match your app’s design.2. Use Image Loading Libraries
Use image loading libraries like Glide or Coil when displaying icon, cover, and profile images.3. Reuse Ad Views
When displaying ads in a RecyclerView, cache and reuse ad instances.4. Appropriate Ad Placement
Place ads naturally without degrading user experience.- Content feed: 1 ad every 5-10 items
- Detail screen: Place at bottom of content
- Scroll view: Place to match natural content flow
5. Error Handling
Implement appropriate fallback handling for ad load failures.Complete Example
Batch Loading (loads)
UseAdropNativeAd.loads() to request multiple native ads in a single batched call. This is useful for prefetching a pool of ads to insert into feeds, carousels, or paginated lists.
Signature
Usage
Listener Callbacks
| Callback | When it fires |
|---|---|
onAdsReceived(ads) | Batch delivered. Every ad is fully rendered — creative is ready to bind. |
onAdsFailedToReceive(errorCode) | Request rejected, network failure, or no fillable ads were returned (ERROR_CODE_AD_NO_FILL). |
onAdClicked / onAdImpression / onAdVideoStart / onAdVideoEnd | Fire on each returned ad just like a single load(). |
Constraints
- Maximum 5 ads per call. If the server returns more, only the first 5 are delivered.
- Backfill is not applied. If no direct ads fill,
onAdsFailedToReceiveis called withERROR_CODE_AD_NO_FILLregardless of backfill configuration. - Do not call
destroy()insideonAdsReceived. Bind each ad to anAdropNativeAdViewviasetNativeAd(...)or store for later lifecycle, thendestroy()on the parentActivity.onDestroy()(or equivalent). - Unlike
AdropBanner.loads(), the native batch waits for every returned ad to finish rendering before firingonAdsReceived, so each instance is fully rendered on delivery.
Backfill Ads
When backfill ads are enabled, backfill ads are automatically loaded when direct ads are unavailable. Use theisBackfilled property to check if the ad is a backfill ad.
AdChoices Position
For backfill native ads, you can choose which corner displays the AdChoices badge. SetpreferredAdChoicesPosition on the AdropNativeAd instance before calling load().
| Value | Description |
|---|---|
AdropAdChoicesPosition.TOP_LEFT | Top-left corner |
AdropAdChoicesPosition.TOP_RIGHT | Top-right corner (default) |
AdropAdChoicesPosition.BOTTOM_LEFT | Bottom-left corner |
AdropAdChoicesPosition.BOTTOM_RIGHT | Bottom-right corner |
This setting is a preferred hint for the backfill network and applies only to backfill native ads — direct ads are not affected. The value must be set before
load() is called. The backfill network may override the position depending on its policy.To use backfill ads, add the
io.adrop:adrop-ads-backfill dependency. See Getting Started.Next Steps
Banner Ads
Implement banner ads
Interstitial Ads
Implement interstitial ads
Targeting Settings
User properties and context targeting
Reference
Classes, listeners, error codes