A PublisherAdRequest
contains targeting information used to fetch an ad from Google Ad Manager for Publishers. Ad
requests are created using PublisherAdRequest.Builder
.
Nested Class Summary
class | PublisherAdRequest.Builder | Builds a PublisherAdRequest . |
|
@interface | PublisherAdRequest.MaxAdContentRating | This @interface is deprecated. Use
RequestConfiguration.MaxAdContentRating |
|
@interface | PublisherAdRequest.TagForUnderAgeOfConsent | This @interface is deprecated. Use
RequestConfiguration.TagForUnderAgeOfConsent |
Constant Summary
String | DEVICE_ID_EMULATOR | The deviceId for emulators to be
used with
setTestDeviceIds(List) . |
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. |
String | MAX_AD_CONTENT_RATING_G | Content suitable for general audiences, including families |
String | MAX_AD_CONTENT_RATING_MA | Content suitable only for mature audiences |
String | MAX_AD_CONTENT_RATING_PG | Content suitable for most audiences with parental guidance |
String | MAX_AD_CONTENT_RATING_T | Content suitable for teen and older audiences |
int | TAG_FOR_UNDER_AGE_OF_CONSENT_FALSE | Indicates the publisher specified that the ad request should not receive treatment for users in the European Economic Area (EEA) under the age of consent. |
int | TAG_FOR_UNDER_AGE_OF_CONSENT_TRUE | Indicates the publisher specified that the ad request should receive treatment for users in the European Economic Area (EEA) under the age of consent. |
int | TAG_FOR_UNDER_AGE_OF_CONSENT_UNSPECIFIED | Indicates that the publisher has not specified whether the ad request should receive treatment for users in the European Economic Area (EEA) under the age of consent. |
Public Method Summary
Date |
getBirthday()
This method is deprecated. No replacement.
|
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.
|
Bundle |
getCustomTargeting()
Returns the custom targeting parameters.
|
int |
getGender()
This method is deprecated. No replacement.
|
Set<String> |
getKeywords()
Returns targeting information keywords.
|
Location |
getLocation()
Returns the user's location targeting information.
|
boolean |
getManualImpressionsEnabled()
Returns
true if manual impression reporting is enabled.
|
List<String> |
getNeighboringContentUrls()
Returns the list of neighboring content URLs or an empty list if no URLs were
set.
|
<T extends NetworkExtras> T |
getNetworkExtras(Class<T>
networkExtrasClass)
Returns extra parameters to pass to a specific ad network adapter.
|
<T extends MediationExtrasReceiver> Bundle |
getNetworkExtrasBundle(Class<T>
adapterClass)
Returns extra parameters to pass to a specific ad network adapter.
|
String |
getPublisherProvidedId()
Returns the identifier used for frequency capping, audience segmentation and
targeting, sequential ad rotation, and other audience-based ad delivery
controls across devices.
|
boolean |
Inherited Method Summary
Constants
public static final String DEVICE_ID_EMULATOR
The deviceId
for emulators to be used with
setTestDeviceIds(List)
.
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 String MAX_AD_CONTENT_RATING_G
Content suitable for general audiences, including families
public static final String MAX_AD_CONTENT_RATING_MA
Content suitable only for mature audiences
public static final String MAX_AD_CONTENT_RATING_PG
Content suitable for most audiences with parental guidance
public static final String MAX_AD_CONTENT_RATING_T
Content suitable for teen and older audiences
public static final int TAG_FOR_UNDER_AGE_OF_CONSENT_FALSE
Indicates the publisher specified that the ad request should not receive treatment for users in the European Economic Area (EEA) under the age of consent.
public static final int TAG_FOR_UNDER_AGE_OF_CONSENT_TRUE
Indicates the publisher specified that the ad request should receive treatment for users in the European Economic Area (EEA) under the age of consent.
public static final int TAG_FOR_UNDER_AGE_OF_CONSENT_UNSPECIFIED
Indicates that the publisher has not specified whether the ad request should receive treatment for users in the European Economic Area (EEA) under the age of consent.
Public Methods
public Date getBirthday ()
This method is deprecated.
No replacement.
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 Bundle getCustomTargeting ()
Returns the custom targeting parameters.
public int getGender ()
This method is deprecated.
No replacement.
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 boolean getManualImpressionsEnabled ()
Returns true
if manual impression reporting is enabled.
public List<String> getNeighboringContentUrls ()
Returns the list of neighboring content URLs or an empty list if no URLs were 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.
public String getPublisherProvidedId ()
Returns the identifier used for frequency capping, audience segmentation and targeting, sequential ad rotation, and other audience-based ad delivery controls across devices.
public boolean isTestDevice (Context context)
Returns true
if this device will receive test ads.