AbstractAdRequestBuilder

abstract class AbstractAdRequestBuilder<T : AbstractAdRequestBuilder<T!>?>


A base builder class to help construct ad requests.

Summary

Public functions

T!
@CanIgnoreReturnValue
addCustomEventExtrasBundle(
    adapterClass: Class<CustomEvent!>!,
    customEventExtras: Bundle!
)

This function is deprecated.

Use addNetworkExtrasBundle instead.

T!

Adds a custom targeting parameter.

T!

Adds a custom targeting parameter with multiple values.

T!

Adds a keyword for targeting purposes.

T!
@CanIgnoreReturnValue
addNetworkExtrasBundle(
    adapterClass: Class<MediationExtrasReceiver!>!,
    networkExtras: Bundle!
)

Adds extra parameters to pass to a specific ad network adapter.

T!

Sets an ad string that represents an ad response.

T!

Sets the content URL for a web site whose content matches the app's primary content.

T!

Sets a custom timeout for HTTPS calls made by the Google Mobile Ads SDK during an ad request.

T!
@CanIgnoreReturnValue
setNeighboringContentUrls(
    neighboringContentUrls: (Mutable)List<String!>!
)

Sets URLs representing web content near an ad.

T!

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

Protected functions

abstract T!

Returns the self instance of a specified subtype.

Public functions

addCustomEventExtrasBundle

@CanIgnoreReturnValue
fun addCustomEventExtrasBundle(
    adapterClass: Class<CustomEvent!>!,
    customEventExtras: Bundle!
): T!

Adds extra parameters to pass to a specific custom event adapter.

Parameters
adapterClass: Class<CustomEvent!>!

The Class of the custom event adapter for which you are providing extras.

customEventExtras: Bundle!

A Bundle of extra information to pass to a custom event adapter.

addCustomTargeting

@CanIgnoreReturnValue
fun addCustomTargeting(key: String!, value: String!): T!

Adds a custom targeting parameter. Calling this a second time with the same key will overwrite the old values.

addCustomTargeting

@CanIgnoreReturnValue
fun addCustomTargeting(key: String!, values: (Mutable)List<String!>!): T!

Adds a custom targeting parameter with multiple values. Calling this a second time with the same key will overwrite the old values.

addKeyword

@CanIgnoreReturnValue
fun addKeyword(keyword: String!): T!

Adds a keyword for targeting purposes.

addNetworkExtrasBundle

@CanIgnoreReturnValue
fun addNetworkExtrasBundle(
    adapterClass: Class<MediationExtrasReceiver!>!,
    networkExtras: Bundle!
): T!

Adds extra parameters to pass to a specific ad network adapter.

Parameters
adapterClass: Class<MediationExtrasReceiver!>!

The Class of the adapter that should receive extras.

networkExtras: Bundle!

A Bundle of extra information to pass to a mediation adapter.

setAdString

@CanIgnoreReturnValue
fun setAdString(adString: String!): T!

Sets an ad string that represents an ad response. If set, the SDK will render this ad and ignore all other targeting information set on this request.

setContentUrl

@CanIgnoreReturnValue
fun setContentUrl(contentUrl: String!): T!

Sets the content URL for a web site whose content matches the app's primary content. This web site content is used for targeting and brand safety purposes.

Throws
java.lang.NullPointerException

If contentUrl is {code null}.

java.lang.IllegalArgumentException

If contentUrl is empty, or if its length exceeds 512.

setHttpTimeoutMillis

@CanIgnoreReturnValue
fun setHttpTimeoutMillis(httpTimeoutMillis: Int): T!

Sets a custom timeout for HTTPS calls made by the Google Mobile Ads SDK during an ad request.

If your app uses mediation, this timeout does not apply to network calls made by third-party ad network SDKs.

Parameters
httpTimeoutMillis: Int

An integer specifying the HTTPS timeout in milliseconds. Any values lower than 5000 (5 seconds) will be ignored. The default value is 60000 (60 seconds).

setNeighboringContentUrls

@CanIgnoreReturnValue
fun setNeighboringContentUrls(
    neighboringContentUrls: (Mutable)List<String!>!
): T!

Sets URLs representing web content near an ad. Promotes brand safety and allows displayed ads to have an app level rating (MA, T, PG, etc) that is more appropriate to neighboring content.

Parameters
neighboringContentUrls: (Mutable)List<String!>!

The list of neighboring content URLs to be attached to the existing neighboring content URLs.

setRequestAgent

@CanIgnoreReturnValue
fun setRequestAgent(requestAgent: String!): T!

Sets the request agent string to identify the ad request's origin. Third party libraries that reference the Mobile Ads SDK should call this method to denote the platform from which the ad request originated. For example, if a third party ad network called "CoolAds network" mediates requests to the Mobile Ads SDK, it should call this method with "CoolAds".

Protected functions

self

protected abstract fun self(): T!

Returns the self instance of a specified subtype.