目录

NativeAdConfiguration.Builder

Class Info

public static final class NativeAdConfiguration.Builder extends Object

Builder for native ad configuration.

Public Constructor Summary

Constructor Name

Builder()

Constructs an ad configuration builder.

Public Method Summary

Qualifier and Type

Method Name and Description

NativeAdConfiguration

build()

Constructs an ad configuration object.

NativeAdConfiguration.Builder

setAdSize(AdSize adSize)

Sets the dimensions of the requested ad.

NativeAdConfiguration.Builder

setChoicesPosition(int choicesPosition)

Sets the ad choice icon position.

NativeAdConfiguration.Builder

setMediaAspect(int aspect)

Sets the aspect ratio of an ad image.

NativeAdConfiguration.Builder

setMediaDirection(int direction)

Sets the orientation of an ad image.

NativeAdConfiguration.Builder

setRequestCustomDislikeThisAd(boolean requestCustomDislikeThisAd)

Sets whether to customize the function of closing the ad.

NativeAdConfiguration.Builder

setRequestMultiImages(boolean requestMultiImages)

Sets whether to request multiple ad images.

NativeAdConfiguration.Builder

setReturnUrlsForImages(boolean returnUrls)

Sets whether to allow the SDK to download native ad images.

NativeAdConfiguration.Builder

setVideoConfiguration(VideoConfiguration videoOptions)

Sets the information about a native video.

Public Constructors

[h2]Builder

Constructor

public Builder()

Constructs an ad configuration builder.

Public Methods

[h2]build

Method

public final NativeAdConfiguration build()

Constructs an ad configuration object.

Returns

Type

Description

NativeAdConfiguration

Ad configuration object.

[h2]setAdSize

Method

public final NativeAdConfiguration.Builder setAdSize(AdSize AdSize)

Sets the dimensions of the requested ad.

Parameters

Name

Description

adSize

Ad dimensions.

Returns

Type

Description

NativeAdConfiguration.Builder

A NativeAdConfiguration.Builder object.

[h2]setChoicesPosition

Method

public final NativeAdConfiguration.Builder setChoicesPosition(int choicesPosition)

Sets the ad choice icon position.

Parameters

Name

Description

choicesPosition

Ad choice icon position. For details, please refer to com.huawei.hms.ads.nativead.NativeAdConfiguration.ChoicesPosition.

Returns

Type

Description

NativeAdConfiguration.Builder

A NativeAdConfiguration.Builder object.

[h2]setMediaAspect

Method

public final NativeAdConfiguration.Builder setMediaAspect(int aspect)

Sets the aspect ratio of an ad image.

Parameters

Name

Description

aspect

Aspect ratio of an ad image. For details, please refer to com.huawei.hms.ads.nativead.NativeAdConfiguration.MediaAspect.

Returns

Type

Description

NativeAdConfiguration.Builder

A NativeAdConfiguration.Builder object.

[h2]setMediaDirection

Method

public final NativeAdConfiguration.Builder setMediaDirection(int direction)

Sets the orientation of an ad image.

Parameters

Name

Description

direction

Orientation of an ad image. For details, please refer to com.huawei.hms.ads.nativead.NativeAdConfiguration.Direction.

Returns

Type

Description

NativeAdConfiguration.Builder

A NativeAdConfiguration.Builder object.

[h2]setRequestCustomDislikeThisAd

Method

public final NativeAdConfiguration.Builder setRequestCustomDislikeThisAd(boolean requestCustomDislikeThisAd)

Sets whether to customize the function of closing the ad.

Parameters

Name

Description

requestCustomDislikeThisAd

Indicates whether to customize the function of closing the ad.

  • true: yes
  • false: no

Returns

Type

Description

NativeAdConfiguration.Builder

A NativeAdConfiguration.Builder object.

[h2]setRequestMultiImages

Method

public final NativeAdConfiguration.Builder setRequestMultiImages(boolean requestMultiImages)

Sets whether to request multiple ad images.

Parameters

Name

Description

requestMultiImages

Indicates whether to request multiple ad images.

  • true: yes
  • false: no

Returns

Type

Description

NativeAdConfiguration.Builder

A NativeAdConfiguration.Builder object.

[h2]setReturnUrlsForImages

Method

public final NativeAdConfiguration.Builder setReturnUrlsForImages(boolean returnUrls)

Sets whether to allow the SDK to download native ad images.

Parameters

Name

Description

returnUrls

Indicates whether to allow the SDK to download native ad images.

  • true: yes
  • false: no

Returns

Type

Description

NativeAdConfiguration.Builder

A NativeAdConfiguration.Builder object.

[h2]setVideoConfiguration

Method

public final NativeAdConfiguration.Builder setVideoConfiguration(VideoConfiguration videoOptions)

Sets the information about a native video.

Parameters

Name

Description

videoOptions

Information about a native video.

Returns

Type

Description

NativeAdConfiguration.Builder

A NativeAdConfiguration.Builder object.