NativeAdRequest

public final class NativeAdRequest extends AdRequest


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

Summary

Nested types

public final class NativeAdRequest.Builder

A builder class for creating NativeAdRequest.

Public methods

@NonNull AdChoicesPlacement

The AdChoices placement.

AdSize
@NonNull List<@NonNull AdSize>
final Bundle

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

final @NonNull Set<@NonNull String>

The slot-level ad category exclusion labels.

final String

The content URL targeting information.

boolean

Whether tap to click is enabled with custom click gesture.

NativeAd.SwipeGestureDirection

The requested custom click gesture direction.

@NonNull List<@NonNull String>

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

final @NonNull Map<@NonNull String, @NonNull String>

The custom targeting parameters.

final @NonNull Bundle

The extra parameters to pass to Google ad network

final @NonNull Set<@NonNull String>

The targeting information keywords.

boolean
@NonNull NativeAd.NativeMediaAspectRatio

The aspect ratio of the media to be returned.

@NonNull List<@NonNull NativeAd.NativeAdType>

A list of native ad types for the request.

final @NonNull Set<@NonNull String>

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

final long

An identifier for a placement in reporting.

final 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.

final String

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

VideoOptions

The VideoOptions for the request.

boolean

Whether image downloading is disabled.

Public methods

getAdChoicesPlacement

public @NonNull AdChoicesPlacement getAdChoicesPlacement()

The AdChoices placement.

getAdSize

public AdSize getAdSize()

getAdSizes

public @NonNull List<@NonNull AdSizegetAdSizes()

getAdSourceExtrasBundle

public final Bundle getAdSourceExtrasBundle(
    @NonNull Class<@NonNull MediationExtrasReceiver> adapterClass
)

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

getCategoryExclusions

public final @NonNull Set<@NonNull StringgetCategoryExclusions()

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

getContentUrl

public final String getContentUrl()

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

getCustomClickGestureAllowTaps

public boolean getCustomClickGestureAllowTaps()

Whether tap to click is enabled with custom click gesture.

getCustomClickGestureDirection

public NativeAd.SwipeGestureDirection getCustomClickGestureDirection()

The requested custom click gesture direction.

getCustomFormatIds

public @NonNull List<@NonNull StringgetCustomFormatIds()

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

getCustomTargeting

public final @NonNull Map<@NonNull String, @NonNull StringgetCustomTargeting()

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

getGoogleExtrasBundle

public final @NonNull Bundle getGoogleExtrasBundle()

The extra parameters to pass to Google ad network

getKeywords

public final @NonNull Set<@NonNull StringgetKeywords()

The targeting information keywords.

getManualImpressionRequested

public boolean getManualImpressionRequested()

getMediaAspectRatio

public @NonNull NativeAd.NativeMediaAspectRatio getMediaAspectRatio()

The aspect ratio of the media to be returned.

getNativeAdTypes

public @NonNull List<@NonNull NativeAd.NativeAdTypegetNativeAdTypes()

A list of native ad types for the request.

getNeighboringContentUrls

public final @NonNull Set<@NonNull StringgetNeighboringContentUrls()

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

getPlacementId

public final long getPlacementId()

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

getPublisherProvidedId

public final String getPublisherProvidedId()

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

getRequestAgent

public final String getRequestAgent()

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

getVideoOptions

public VideoOptions getVideoOptions()

The VideoOptions for the request.

isImageLoadingDisabled

public boolean isImageLoadingDisabled()

Whether image downloading is disabled.