NativeAdOptions.Builder

public final class NativeAdOptions.Builder


Builder class for NativeAdOptions.

Summary

Public constructors

Public methods

NativeAdOptions

Constructs a NativeAdOptions object with the specified attributes.

NativeAdOptions.Builder
@CanIgnoreReturnValue
enableCustomClickGestureDirection(
    @NativeAdOptions.SwipeGestureDirection int swipeGestureDirection,
    boolean tapsAllowed
)

Enables swipes as a custom click gesture.

NativeAdOptions.Builder

Sets the placement of AdChoices icon (if present).

NativeAdOptions.Builder

Sets the media aspect ratio.

NativeAdOptions.Builder
@CanIgnoreReturnValue
setRequestCustomMuteThisAd(boolean requestCustomMuteThisAd)

Set this boolean to true to request a custom implementation for the Mute This Ad feature.

NativeAdOptions.Builder
@CanIgnoreReturnValue
setRequestMultipleImages(boolean shouldRequestMultipleImages)

Sets whether multiple images should be requested or not.

NativeAdOptions.Builder

Sets whether URLs alone should be returned for image assets.

NativeAdOptions.Builder

Sets the VideoOptions object.

Public constructors

Builder

public Builder()

Public methods

build

public NativeAdOptions build()

Constructs a NativeAdOptions object with the specified attributes.

enableCustomClickGestureDirection

@CanIgnoreReturnValue
public NativeAdOptions.Builder enableCustomClickGestureDirection(
    @NativeAdOptions.SwipeGestureDirection int swipeGestureDirection,
    boolean tapsAllowed
)

Enables swipes as a custom click gesture.

Parameters
@NativeAdOptions.SwipeGestureDirection int swipeGestureDirection

The SwipeGestureDirection to be counted as a click.

boolean tapsAllowed

Whether taps should still be allowed as clicks.

Available for allowlisted publishers only. These settings will be ignored for publishers not allowlisted.

setAdChoicesPlacement

@CanIgnoreReturnValue
public NativeAdOptions.Builder setAdChoicesPlacement(
    @NativeAdOptions.AdChoicesPlacement int adChoicesPlacement
)

Sets the placement of AdChoices icon (if present). The value should be one of ADCHOICES_TOP_LEFT, ADCHOICES_TOP_RIGHT, ADCHOICES_BOTTOM_RIGHT or ADCHOICES_BOTTOM_LEFT. The default value is ADCHOICES_TOP_RIGHT.

setMediaAspectRatio

@CanIgnoreReturnValue
public NativeAdOptions.Builder setMediaAspectRatio(
    @NativeAdOptions.NativeMediaAspectRatio int aspectRatio
)

Sets the media aspect ratio.

Parameters
@NativeAdOptions.NativeMediaAspectRatio int aspectRatio

aspect ratio to be set using one of NativeMediaAspectRatio options.

setRequestCustomMuteThisAd

@CanIgnoreReturnValue
public NativeAdOptions.Builder setRequestCustomMuteThisAd(boolean requestCustomMuteThisAd)

Set this boolean to true to request a custom implementation for the Mute This Ad feature. Default value is false.

setRequestMultipleImages

@CanIgnoreReturnValue
public NativeAdOptions.Builder setRequestMultipleImages(boolean shouldRequestMultipleImages)

Sets whether multiple images should be requested or not. Default value is false.

setReturnUrlsForImageAssets

@CanIgnoreReturnValue
public NativeAdOptions.Builder setReturnUrlsForImageAssets(boolean shouldReturnUrls)

Sets whether URLs alone should be returned for image assets. If true, the SDK will not download image assets and instead return a NativeAd.Image with just the URI and Scale properties populated. If false, the SDK will automatically download image assets and return a NativeAd.Image with all three properties (URI, Scale, and Drawable) populated. The default value is false.

setVideoOptions

@CanIgnoreReturnValue
public NativeAdOptions.Builder setVideoOptions(VideoOptions videoOptions)

Sets the VideoOptions object.