Builds a PublisherAdRequest
.
Public Constructor Summary
Public Method Summary
PublisherAdRequest.Builder | |
PublisherAdRequest.Builder |
addCustomEventExtrasBundle(Class<? extends CustomEvent>
adapterClass, Bundle
customEventExtras)
Add extra parameters to pass to a specific custom event adapter.
|
PublisherAdRequest.Builder | |
PublisherAdRequest.Builder | |
PublisherAdRequest.Builder | |
PublisherAdRequest.Builder |
addNetworkExtras(NetworkExtras
networkExtras)
Add extra parameters to pass to a specific ad network adapter.
|
PublisherAdRequest.Builder |
addNetworkExtrasBundle(Class<? extends MediationAdapter>
adapterClass, Bundle
networkExtras)
Add extra parameters to pass to a specific ad network adapter.
|
PublisherAdRequest.Builder | |
PublisherAdRequest |
build()
Constructs
PublisherAdRequest with the specified attributes.
|
PublisherAdRequest.Builder | |
PublisherAdRequest.Builder | |
PublisherAdRequest.Builder |
setGender(int gender)
This method was deprecated. No replacement.
|
PublisherAdRequest.Builder |
setIsDesignedForFamilies(boolean isDesignedForFamilies)
This method was deprecated. Use
setMaxAdContentRating(String)
|
PublisherAdRequest.Builder | |
PublisherAdRequest.Builder |
setManualImpressionsEnabled(boolean manualImpressionsEnabled)
This method was deprecated. Manual impressions should be enabled with
setManualImpressionsEnabled(boolean) .
|
PublisherAdRequest.Builder | |
PublisherAdRequest.Builder |
setPublisherProvidedId(String
publisherProvidedId)
Sets an identifier for use in frequency capping, audience segmentation and
targeting, sequential ad rotation, and other audience-based ad delivery
controls across devices.
|
PublisherAdRequest.Builder |
setRequestAgent(String
requestAgent)
Sets the request agent string to identify the ad request's origin.
|
PublisherAdRequest.Builder |
setTagForUnderAgeOfConsent(int tagForUnderAgeOfConsent)
This method allows you to mark your ad requests to receive treatment for users
in the European Economic Area (EEA) under the age of consent.
|
PublisherAdRequest.Builder |
tagForChildDirectedTreatment(boolean tagForChildDirectedTreatment)
This method allows you to specify whether you would like your app to be treated
as child-directed for purposes of the Children’s Online Privacy Protection Act
(COPPA) - //business.ftc.gov/privacy-and-security/childrens-privacy.
|
Inherited Method Summary
Public Constructors
public PublisherAdRequest.Builder ()
Public Methods
public PublisherAdRequest.Builder addCategoryExclusion (String categoryExclusion)
Sets a slot-level ad category exclusion label.
public PublisherAdRequest.Builder addCustomEventExtrasBundle (Class<? extends CustomEvent> adapterClass, Bundle customEventExtras)
public PublisherAdRequest.Builder addCustomTargeting (String key, List<String> values)
Adds a custom targeting parameter. Calling this multiple times for the same key will overwrite old values.
public PublisherAdRequest.Builder addCustomTargeting (String key, String value)
Adds a custom targeting parameter. Calling this multiple times for the same key will overwrite old values.
public PublisherAdRequest.Builder addKeyword (String keyword)
Add a keyword for targeting purposes.
public PublisherAdRequest.Builder addNetworkExtras (NetworkExtras networkExtras)
Add extra parameters to pass to a specific ad network adapter. The networkExtras
parameter should be an instance of com.google.ads.mediation.NetworkExtras
,
which is provided by ad network adapters.
Note that the NetworkExtras
class has been deprecated. This method is
included to maintain compatibility with older adapters.
public PublisherAdRequest.Builder addNetworkExtrasBundle (Class<? extends MediationAdapter> adapterClass, Bundle networkExtras)
public PublisherAdRequest.Builder addTestDevice (String deviceId)
Causes a device to receive test ads. The deviceId
can be obtained by
viewing the logcat output after creating a new ad. For emulators, use
DEVICE_ID_EMULATOR
.
This method should only be used while debugging. Be sure to remove all calls to this method before releasing your app.
public PublisherAdRequest build ()
Constructs PublisherAdRequest
with the specified attributes.
public PublisherAdRequest.Builder setBirthday (Date birthday)
This method was deprecated.
No replacement.
Sets the user's birthday for targeting purposes.
public PublisherAdRequest.Builder setContentUrl (String contentUrl)
Sets the content URL for targeting purposes.
Throws
NullPointerException | If contentUrl is {code null}. |
---|---|
IllegalArgumentException | If contentUrl is empty, or if its length exceeds 512. |
public PublisherAdRequest.Builder setGender (int gender)
This method was deprecated.
No replacement.
Sets the user's gender for targeting purposes. This should be
GENDER_MALE
,
GENDER_FEMALE
, or
GENDER_UNKNOWN
.
public PublisherAdRequest.Builder setIsDesignedForFamilies (boolean isDesignedForFamilies)
This method was deprecated.
Use
setMaxAdContentRating(String)
This method allows apps that have opted into the Designed for Families program to specify whether a given ad request should return Designed for Families-compliant ads. Please note that the method is ONLY intended for apps that have opted into Designed for Families.
If you set this value to true
, you indicate that your app requires that
the ad request should return a Designed for Families-compliant ad.
If you set this value to false
, you indicate that your app does not
require that the ad request should return a Designed for Families-compliant ad.
Note: This setting is separate from the Children's
Online Privacy Protection Act (COPPA) "tag for child directed treatment" setting.
For COPPA-related compliance, see
tagForChildDirectedTreatment(boolean)
.
public PublisherAdRequest.Builder setLocation (Location location)
Sets the user's location for targeting purposes.
public PublisherAdRequest.Builder setManualImpressionsEnabled (boolean manualImpressionsEnabled)
This method was deprecated.
Manual impressions should be enabled with
setManualImpressionsEnabled(boolean)
.
Enables manual impression reporting.
public PublisherAdRequest.Builder setMaxAdContentRating (String maxAdContentRating)
Set a maximum ad content rating. Google AdMob ads returned for these requests have a
content rating at or below that level. Valid values are
MAX_AD_CONTENT_RATING_G
,
MAX_AD_CONTENT_RATING_PG
,
MAX_AD_CONTENT_RATING_T
, and
MAX_AD_CONTENT_RATING_MA
.
public PublisherAdRequest.Builder setPublisherProvidedId (String publisherProvidedId)
Sets an identifier for use in frequency capping, audience segmentation and targeting, sequential ad rotation, and other audience-based ad delivery controls across devices.
public PublisherAdRequest.Builder setRequestAgent (String requestAgent)
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".
public PublisherAdRequest.Builder setTagForUnderAgeOfConsent (int tagForUnderAgeOfConsent)
This method allows you to mark your ad requests to receive treatment for users in the European Economic Area (EEA) under the age of consent. This feature is designed to help facilitate compliance with the General Data Protection Regulation (GDPR). Note that you may have other legal obligations under GDPR. Please review the European Union's guidance and consult with your own legal counsel. Please remember that Google's tools are designed to facilitate compliance and do not relieve any particular publisher of its obligations under the law.
When using this feature, a Tag For Users under the Age of Consent in Europe (TFUA) parameter will be included in the ad request. This parameter disables personalized advertising, including remarketing, for that specific ad request. It also disables requests to third-party ad vendors, such as ad measurement pixels and third-party ad servers.
If you set this method to
TAG_FOR_UNDER_AGE_OF_CONSENT_TRUE
, you will indicate that you want the ad
request to be handled in a manner suitable for users under the age of consent.
If you set this method to
TAG_FOR_UNDER_AGE_OF_CONSENT_FALSE
, you will indicate that you don't want
the ad request to be handled in a manner suitable for users under the age of
consent.
If you do not set this method, or set this method to
TAG_FOR_UNDER_AGE_OF_CONSENT_UNSPECIFIED
, ad requests will include no
indication of how you would like your app to be handled in a manner suitable for users
under the age of consent.
public PublisherAdRequest.Builder tagForChildDirectedTreatment (boolean tagForChildDirectedTreatment)
This method allows you to specify whether you would like your app to be treated as child-directed for purposes of the Children’s Online Privacy Protection Act (COPPA) - //business.ftc.gov/privacy-and-security/childrens-privacy.
If you set this method to true
, you will indicate that your app should
be treated as child-directed for purposes of the Children’s Online Privacy Protection
Act (COPPA).
If you set this method to false
, you will indicate that your app should
not be treated as child-directed for purposes of the Children’s Online Privacy
Protection Act (COPPA).
If you do not set this method, ad requests will include no indication of how you would like your app treated with respect to COPPA.
By setting this method, you certify that this notification is accurate and you are authorized to act on behalf of the owner of the app. You understand that abuse of this setting may result in termination of your Google account.
Note: it may take some time for this designation to be fully implemented in applicable Google services.
This designation will only apply to ad requests for which you have set this method.
Parameters
tagForChildDirectedTreatment | Set to true to indicate that your app should be treated as
child-directed. Set to false to indicate that your app should not be
treated as child-directed. |
---|