UnifiedNativeAdMapper

abstract class UnifiedNativeAdMapper


Mapping class for Google AdMob unified native ads.

Mediation adapters that load a native ad must extend this class to provide a mapping from the mediated ad network's native ad object to com.google.android.gms.ads.formats.UnifiedNativeAd.

Summary

Public constructors

Public functions

Unit

Subclasses should implement this method if the mediated network's SDK offers a way to destroy the native ad object.

Float

Gets the video's current time.

Float

Gets the video's duration.

Unit
handleClick(view: View!)

Subclasses should implement this method if the network requires the developer to explicitly handle click events of views rendered to screen.

Boolean

Returns true if the current ad has video content.

Unit

Subclasses should implement this method if the network requires the developer to explicitly record an impression of a view rendered to screen.

Unit
setHasVideoContent(hasVideoContent: Boolean)

Set to true if the current ad has video content.

Unit
setMediaView(mediaView: View!)

Sets mediated view that displays media.

Unit
trackViews(
    containerView: View!,
    clickableAssetViews: (Mutable)Map<String!, View!>!,
    nonclickableAssetViews: (Mutable)Map<String!, View!>!
)

Subclasses should implement this method if the network requires the developer to prepare state for recording an impression and/or click before a view is rendered to screen.

Unit
untrackView(view: View!)

Subclasses should implement this method if the mediated network's SDK offers a way to stop tracking a native ad view for the ad mapped by this object.

Public constructors

UnifiedNativeAdMapper

UnifiedNativeAdMapper()

Public functions

destroy

fun destroy(): Unit

Subclasses should implement this method if the mediated network's SDK offers a way to destroy the native ad object.

getCurrentTime

fun getCurrentTime(): Float

Gets the video's current time. Returns zero by default. Subclasses should override this method to return a nonzero current time for video ads.

getDuration

fun getDuration(): Float

Gets the video's duration. Returns zero by default. Subclasses should override this method to return a nonzero duration for video ads.

handleClick

fun handleClick(view: View!): Unit

Subclasses should implement this method if the network requires the developer to explicitly handle click events of views rendered to screen.

hasVideoContent

fun hasVideoContent(): Boolean

Returns true if the current ad has video content.

recordImpression

fun recordImpression(): Unit

Subclasses should implement this method if the network requires the developer to explicitly record an impression of a view rendered to screen.

setHasVideoContent

fun setHasVideoContent(hasVideoContent: Boolean): Unit

Set to true if the current ad has video content.

setMediaView

fun setMediaView(mediaView: View!): Unit

Sets mediated view that displays media. This is typically the View provided by the mediated SDK to display video content for an ad, but should display an image asset if no video is present. Adapters are expected to set a View for this property for every ad.

trackViews

fun trackViews(
    containerView: View!,
    clickableAssetViews: (Mutable)Map<String!, View!>!,
    nonclickableAssetViews: (Mutable)Map<String!, View!>!
): Unit

Subclasses should implement this method if the network requires the developer to prepare state for recording an impression and/or click before a view is rendered to screen. Find the asset names in UnifiedNativeAdAssetNames.

Parameters
containerView: View!

The container View for the ad.

clickableAssetViews: (Mutable)Map<String!, View!>!

The Map of clickable asset names to corresponding View.

nonclickableAssetViews: (Mutable)Map<String!, View!>!

The Map of non-clickable asset names to corresponding View.

untrackView

fun untrackView(view: View!): Unit

Subclasses should implement this method if the mediated network's SDK offers a way to stop tracking a native ad view for the ad mapped by this object.

Public properties

adChoicesContent

var adChoicesContent: View!

advertiser

var advertiser: String!

body

var body: String!

callToAction

var callToAction: String!

extras

var extras: Bundle!

headline

var headline: String!

icon

var icon: NativeAd.Image!

images

var images: (Mutable)List<NativeAd.Image!>!

mediaContentAspectRatio

var mediaContentAspectRatio: Float

overrideClickHandling

var overrideClickHandling: Boolean

overrideImpressionRecording

var overrideImpressionRecording: Boolean

price

var price: String!

starRating

var starRating: Double!

store

var store: String!