NativeAdRequest

class NativeAdRequest : AdRequest


A native ad request. See Builder for how to construct a NativeAdRequest.

Summary

Nested types

A builder class for creating NativeAdRequest.

Public functions

Bundle?

Gets the extras bundle associated with an ad source's adapter, if present.

Public properties

open AdChoicesPlacement

The AdChoices placement.

Boolean

Determines whether ad persistence is enabled for this request.

open AdSize?
open List<AdSize>
Set<String>

The slot-level ad category exclusion labels.

String?

The content URL targeting information.

open Boolean

Whether tap to click is enabled with custom click gesture.

open NativeAd.SwipeGestureDirection?

The requested custom click gesture direction.

open List<String>

A list of custom native ad format IDs defined in the Ad Manager UI.

Map<StringString>

The custom targeting parameters.

Bundle

The extra parameters to pass to Google ad network

open Boolean

Whether image downloading is disabled.

Set<String>

The targeting information keywords.

open Boolean
open NativeAd.NativeMediaAspectRatio

The aspect ratio of the media to be returned.

open List<NativeAd.NativeAdType>

A list of native ad types for the request.

Set<String>

The list of neighboring content URLs or an empty List if no URLs were set.

Long

An identifier for a placement in reporting.

String?

A publisher-provided identifier used for frequency capping, audience segmentation and targeting, sequential ad rotation, and other audience-based ad delivery controls across devices.

String?

The request agent string to identify the ad request's origin.

open VideoOptions?

The VideoOptions for the request.

Inherited properties

From com.google.android.libraries.ads.mobile.sdk.common.AdRequest
open String

The ad unit ID.

Public functions

getAdSourceExtrasBundle

fun getAdSourceExtrasBundle(adapterClass: Class<MediationExtrasReceiver>): Bundle?

Gets the extras bundle associated with an ad source's adapter, if present.

Public properties

adChoicesPlacement

open val adChoicesPlacementAdChoicesPlacement

The AdChoices placement.

adPersistenceEnabled

@ExperimentalApi
val adPersistenceEnabledBoolean

Determines whether ad persistence is enabled for this request.

When enabled, this field introduces two distinct behavior changes to the ad loading process:

  1. Cache-First Retrieval: The SDK attempts to serve an ad from local storage first. If the cache is empty, it falls back to a network request.

  2. Proactive Refresh: Regardless of how the current ad was served, the SDK fetches additional ads and persists them to local storage to service the next request.

adSize

open val adSizeAdSize?

adSizes

open val adSizesList<AdSize>

categoryExclusions

val categoryExclusionsSet<String>

The slot-level ad category exclusion labels. Default to an empty Set if not set.

contentUrl

val contentUrlString?

The content URL targeting information. Default to null if not set.

customClickGestureAllowTaps

open val customClickGestureAllowTapsBoolean

Whether tap to click is enabled with custom click gesture.

customClickGestureDirection

open val customClickGestureDirectionNativeAd.SwipeGestureDirection?

The requested custom click gesture direction.

customFormatIds

open val customFormatIdsList<String>

A list of custom native ad format IDs defined in the Ad Manager UI. Used to load native ads of type NativeAdType.CUSTOM_NATIVE.

customTargeting

val customTargetingMap<StringString>

The custom targeting parameters. Default to an empty Map if not set.

googleExtrasBundle

val googleExtrasBundleBundle

The extra parameters to pass to Google ad network

isImageLoadingDisabled

open val isImageLoadingDisabledBoolean

Whether image downloading is disabled.

keywords

val keywordsSet<String>

The targeting information keywords.

manualImpressionRequested

open val manualImpressionRequestedBoolean

mediaAspectRatio

open val mediaAspectRatioNativeAd.NativeMediaAspectRatio

The aspect ratio of the media to be returned.

nativeAdTypes

open val nativeAdTypesList<NativeAd.NativeAdType>

A list of native ad types for the request.

neighboringContentUrls

val neighboringContentUrlsSet<String>

The list of neighboring content URLs or an empty List if no URLs were set.

placementId

val placementIdLong

An identifier for a placement in reporting. A value set here will be set onto any ad returned by this request.

publisherProvidedId

val publisherProvidedIdString?

A publisher-provided identifier used for frequency capping, audience segmentation and targeting, sequential ad rotation, and other audience-based ad delivery controls across devices.

requestAgent

val requestAgentString?

The request agent string to identify the ad request's origin.

videoOptions

open val videoOptionsVideoOptions?

The VideoOptions for the request.