An AdRequest
contains targeting information used to fetch an ad. Ad requests are created
using AdRequest.Builder
.
Publishers using DoubleClick for Publishers or Search Ads for Apps should use
PublisherAdRequest
or
SearchAdRequest
, respectively.
Nested Class Summary
class | AdRequest.Builder | Builds an AdRequest . |
Constant Summary
int | ERROR_CODE_INTERNAL_ERROR | Something happened internally; for instance, an invalid response was received from the ad server. |
int | ERROR_CODE_INVALID_REQUEST | The ad request was invalid; for instance, the ad unit ID was incorrect. |
int | ERROR_CODE_NETWORK_ERROR | The ad request was unsuccessful due to network connectivity. |
int | ERROR_CODE_NO_FILL | The ad request was successful, but no ad was returned due to lack of ad inventory. |
int | GENDER_FEMALE | Female gender. |
int | GENDER_MALE | Male gender. |
int | GENDER_UNKNOWN | Unknown gender. |
int | MAX_CONTENT_URL_LENGTH | The maximum content URL length. |
Field Summary
public static final String | DEVICE_ID_EMULATOR | The deviceId for emulators to be used with
addTestDevice(String) . |
Public Method Summary
Date |
getBirthday()
Returns the user's birthday targeting information.
|
String |
getContentUrl()
Returns the content URL targeting information.
|
<T extends CustomEvent> Bundle |
getCustomEventExtrasBundle(Class<T> adapterClass)
Returns extra parameters to pass to a specific custom event adapter.
|
int |
getGender()
Returns the user's gender targeting information.
|
Set<String> |
getKeywords()
Returns targeting information keywords.
|
Location |
getLocation()
Returns the user's location targeting information.
|
<T extends NetworkExtras> T |
getNetworkExtras(Class<T> networkExtrasClass)
Returns extra parameters to pass to a specific ad network adapter.
|
<T extends MediationAdapter> Bundle |
getNetworkExtrasBundle(Class<T> adapterClass)
Returns extra parameters to pass to a specific ad network adapter.
|
boolean |
Inherited Method Summary
Constants
public static final int ERROR_CODE_INTERNAL_ERROR
Something happened internally; for instance, an invalid response was received from the ad server.
public static final int ERROR_CODE_INVALID_REQUEST
The ad request was invalid; for instance, the ad unit ID was incorrect.
public static final int ERROR_CODE_NETWORK_ERROR
The ad request was unsuccessful due to network connectivity.
public static final int ERROR_CODE_NO_FILL
The ad request was successful, but no ad was returned due to lack of ad inventory.
public static final int GENDER_FEMALE
Female gender.
public static final int GENDER_MALE
Male gender.
public static final int GENDER_UNKNOWN
Unknown gender.
public static final int MAX_CONTENT_URL_LENGTH
The maximum content URL length.
Fields
public static final String DEVICE_ID_EMULATOR
The deviceId
for emulators to be used with
addTestDevice(String)
.
Public Methods
public Date getBirthday ()
Returns the user's birthday targeting information. Returns null
if the birthday was
not set.
public String getContentUrl ()
Returns the content URL targeting information. Returns null
if the contentUrl was
not set.
public Bundle getCustomEventExtrasBundle (Class<T> adapterClass)
Returns extra parameters to pass to a specific custom event adapter. Returns null
if
no custom event extras of the provided type were set.
public int getGender ()
Returns the user's gender targeting information. Returns -1
if the gender was not
set.
public Set<String> getKeywords ()
Returns targeting information keywords. Returns an empty Set
if no
keywords were added.
public Location getLocation ()
Returns the user's location targeting information. Returns null
if the location was
not set.
public T getNetworkExtras (Class<T> networkExtrasClass)
Returns extra parameters to pass to a specific ad network adapter. Ad network adapters
provide a NetworkExtras
class. Returns null
if no network extras of the
provided type were set.
public Bundle getNetworkExtrasBundle (Class<T> adapterClass)
Returns extra parameters to pass to a specific ad network adapter. Returns null
if no
network extras of the provided type were set.