Class AdRequest.Builder

com.yandex.mobile.ads

public class AdRequest.Builder

Class for creating a targeted ad request.

Methods

AdRequest build()

Creates an object of the class AdRequest with data for a targeted ad request.

AdRequest.Builder withAge(@NonNull final String age)

Sets the user's age in the app.

AdRequest.Builder withContextQuery(@NonNull final String contextQuery)

Sets the search query that the user entered in the app.

AdRequest.Builder withContextTags(@NonNull final List< String > contextTags)

Sets a list of tags that describe the current user context.

AdRequest.Builder withGender(@NonNull final String gender)

Sets the user's gender in the app.

AdRequest.Builder withLocation(@NonNull final android.location.Location location)

Sets the user location.

AdRequest.Builder withParameters(@NonNull final Map< String, String > parameters)

Specifies a list of additional parameters.

Method Detail

build

public AdRequest build ()

Creates an object of the class AdRequest with data for a targeted ad request.

Returns:

An object of the AdRequest with the specified attributes.

withAge

public AdRequest.Builder withAge (@NonNull final String age)

Sets the user's age in the app.

Used for targeting.
Parameters:
age

User age.

Returns:

An object of theAdRequest.Builder class with the the specified user age.

withContextQuery

public AdRequest.Builder withContextQuery (@NonNull final String contextQuery)

Sets the search query that the user entered in the app.

Used for creating a targeted ad request.
Parameters:
contextQuery

The search query that the user entered in the app.

Returns:

An object of the AdRequest.Builder class with the specified search query.

withContextTags

public AdRequest.Builder withContextTags (@NonNull final List< String > contextTags)

Sets a list of tags that describe the current user context.

The list depends on which screen the user is on. Used for creating a targeted ad request.
Parameters:
contextTags

A list of tags produced by the app.

Returns:

An object of the AdRequest.Builder class with a list of the specified tags.

withGender

public AdRequest.Builder withGender (@NonNull final String gender)

Sets the user's gender in the app.

Used for targeting.
Parameters:
gender

The gender of the user.

Returns:

An object of the AdRequest.Builder class with the specified gender.

withLocation

public AdRequest.Builder withLocation (@NonNull final android.location.Location location)

Sets the user location.

Used for creating a targeted ad request.
Parameters:
location

User location.

Returns:

An object of the AdRequest.Builder class with the specified user location.

withParameters

public AdRequest.Builder withParameters (@NonNull final Map< String, String > parameters)

Specifies a list of additional parameters.

Parameters:
parameters

Additional parameters.

Returns:

An object of the AdRequest.Builder class with a list of the specified additional parameters.