NativeAd

interface NativeAd : Ad


A native ad is composed of ad assets that are displayed using Android UI components.

Summary

Nested types

Ad types of a native request.

Media aspect ratio.

Custom click swipe gesture direction.

Public functions

Unit

Enables publishers reporting clicks using custom gestures for this NativeAd.

Boolean

Indicates whether clicks can be reported using custom click gestures.

Unit

Reports clicks for this NativeAd using custom click gesture.

Public properties

AdChoicesInfo?

The information for the AdChoices attribution.

NativeAdEventCallback?

Callback for receiving native ad lifecycle events.

String?

The text that identifies the advertiser.

String?

The body text.

String?

The ad's call to action (such as "Buy" or "Install").

Bundle

Retrieves extras assets associated with a native ad, if set by a mediation partner using com.google.android.gms.ads.mediation.NativeAdMapper.extras.

String?

The primary text headline.

Image?

A small image identifying the advertiser.

Image?

The main image.

MediaContent

The media content associated with this ad.

String?

For ads about apps, returns a string representing how much the app costs.

Double?

For ads about apps, returns a star rating from 0 to 5 representing how many stars the app has in the store offering it.

String?

For ads about apps, returns the name of the store offering the app for download.

Inherited functions

From com.google.android.libraries.ads.mobile.sdk.common.Ad
Unit

Destroys the ad, stopping any extra processing and destroying resources associated with the ad.

ResponseInfo

Gets information about the ad response for this ad.

Inherited properties

From com.google.android.libraries.ads.mobile.sdk.common.Ad
Long

An identifier for a placement in reporting.

Public functions

enableCustomClickGesture

fun enableCustomClickGesture(): Unit

Enables publishers reporting clicks using custom gestures for this NativeAd. The ad unit must be allowlisted to be able to use this method.

By default SDK tracks clicks on asset views. If this method is called, SDK will no longer track clicks for this NativeAd. It should be called before showing the ad.

isCustomClickGestureEnabled

fun isCustomClickGestureEnabled(): Boolean

Indicates whether clicks can be reported using custom click gestures. Reach out to your account manager to allowlist your ad unit for this feature.

recordCustomClickGesture

fun recordCustomClickGesture(): Unit

Reports clicks for this NativeAd using custom click gesture. The ad unit must be allowlisted to be able to use this method.

enableCustomClickGesture must be called before calling this method.

Public properties

adChoicesInfo

val adChoicesInfoAdChoicesInfo?

The information for the AdChoices attribution.

adEventCallback

var adEventCallbackNativeAdEventCallback?

Callback for receiving native ad lifecycle events.

advertiser

val advertiserString?

The text that identifies the advertiser.

body

val bodyString?

The body text.

callToAction

val callToActionString?

The ad's call to action (such as "Buy" or "Install").

extras

val extrasBundle

Retrieves extras assets associated with a native ad, if set by a mediation partner using com.google.android.gms.ads.mediation.NativeAdMapper.extras. Returns an empty bundle in non-mediation scenario.

headline

val headlineString?

The primary text headline.

icon

val iconImage?

A small image identifying the advertiser.

image

val imageImage?

The main image.

mediaContent

val mediaContentMediaContent

The media content associated with this ad.

price

val priceString?

For ads about apps, returns a string representing how much the app costs.

starRating

val starRatingDouble?

For ads about apps, returns a star rating from 0 to 5 representing how many stars the app has in the store offering it.

store

val storeString?

For ads about apps, returns the name of the store offering the app for download. For example, "Google Play".