Packagecom.distriqt.extension.adverts.builders
Classpublic class AdRequestBuilder
InheritanceAdRequestBuilder Inheritance Object

Use this class to construct your AdRequest objects for loading adverts.



Public Methods
 MethodDefined By
  
Constructor
AdRequestBuilder
  
Add a keyword for targeting purposes.
AdRequestBuilder
  
addNetworkExtra(name:String, value:String):AdRequestBuilder
Adds extra parameters to pass to the AdMob network adapter
AdRequestBuilder
  
Deprecated: Use RequestConfiguration
Causes a device to receive test ads.
AdRequestBuilder
  
Constructs an AdRequest with the specified attributes.
AdRequestBuilder
  
maxAdContentRating(contentRating:String):AdRequestBuilder
Deprecated: Use RequestConfiguration
Apps can set a maximum ad content rating for their ad requests using the max_ad_content_rating network extra.
AdRequestBuilder
  
The default behavior of the Google Mobile Ads SDK is to serve personalized ads.
AdRequestBuilder
  
Deprecated: No longer supported
Sets the user's birthday for targeting purposes.
AdRequestBuilder
  
Deprecated: No longer supported
Sets the user's gender for targeting purposes.
AdRequestBuilder
  
setIsDesignedForFamilies(isDesignedForFamilies:Boolean):AdRequestBuilder
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.
AdRequestBuilder
  
tagForChildDirectedTreatment(tagForChildDirectedTreatment:Boolean):AdRequestBuilder
Deprecated: Use RequestConfiguration
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.
AdRequestBuilder
  
tagForUnderAgeOfConsent(underAgeOfConsent:Boolean = false):AdRequestBuilder
Deprecated: Use RequestConfiguration
You can mark your ad requests to receive treatment for users in the European Economic Area (EEA) under the age of consent.
AdRequestBuilder
Constructor Detail
AdRequestBuilder()Constructor
public function AdRequestBuilder()

Constructor

Method Detail
addKeyword()method
public function addKeyword(keyword:String):AdRequestBuilder

Add a keyword for targeting purposes.

Parameters

keyword:String

Returns
AdRequestBuilderAdRequestBuilder instance for chaining calls
addNetworkExtra()method 
public function addNetworkExtra(name:String, value:String):AdRequestBuilder

Adds extra parameters to pass to the AdMob network adapter

Parameters

name:String — Parameter name eg "collapsible"
 
value:String — Parameter value eg "top"

Returns
AdRequestBuilderAdRequestBuilder instance for chaining calls
addTestDevice()method 
public function addTestDevice(deviceId:String):AdRequestBuilder
Deprecated: Use RequestConfiguration

Causes a device to receive test ads.

The deviceId can be obtained by viewing the logcat output after creating a new ad.

Parameters

deviceId:String — The id of the device

Returns
AdRequestBuilderAdRequestBuilder instance for chaining calls
build()method 
public function build():AdRequest

Constructs an AdRequest with the specified attributes.

Returns
AdRequest
maxAdContentRating()method 
public function maxAdContentRating(contentRating:String):AdRequestBuilder
Deprecated: Use RequestConfiguration

Apps can set a maximum ad content rating for their ad requests using the max_ad_content_rating network extra. AdMob ads returned for these requests have a content rating at or below that level.

The possible values for this network extra are based on digital content label classifications, and should be one of the following strings:

Parameters

contentRating:String

Returns
AdRequestBuilderAdRequestBuilder instance for chaining calls
nonPersonalisedAds()method 
public function nonPersonalisedAds(npa:Boolean = true):AdRequestBuilder

The default behavior of the Google Mobile Ads SDK is to serve personalized ads. If a user has consented to receive only non-personalized ads, you can configure an AdRequest object with the following code to specify that only non-personalized ads should be returned:

Parameters

npa:Boolean (default = true) — If true only non-personalised ads will be returned

Returns
AdRequestBuilderAdRequestBuilder instance for chaining calls
setBirthday()method 
public function setBirthday(birthday:Date):AdRequestBuilder
Deprecated: No longer supported

Sets the user's birthday for targeting purposes.

Parameters

birthday:Date — The user's birthday

Returns
AdRequestBuilderAdRequestBuilder instance for chaining calls
setGender()method 
public function setGender(gender:int):AdRequestBuilder
Deprecated: No longer supported

Sets the user's gender for targeting purposes.

Parameters

gender:int — This should be GENDER_MALE, GENDER_FEMALE, or GENDER_UNKNOWN.

Returns
AdRequestBuilderAdRequestBuilder instance for chaining calls
setIsDesignedForFamilies()method 
public function setIsDesignedForFamilies(isDesignedForFamilies:Boolean):AdRequestBuilder

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. Please see the AdMob help center article for more information about this setting.

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().

Parameters

isDesignedForFamilies:Boolean

Returns
AdRequestBuilderAdRequestBuilder instance for chaining calls

See also

tagForChildDirectedTreatment()method 
public function tagForChildDirectedTreatment(tagForChildDirectedTreatment:Boolean):AdRequestBuilder
Deprecated: Use RequestConfiguration

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.

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:Boolean

Returns
AdRequestBuilderAdRequestBuilder instance for chaining calls
tagForUnderAgeOfConsent()method 
public function tagForUnderAgeOfConsent(underAgeOfConsent:Boolean = false):AdRequestBuilder
Deprecated: Use RequestConfiguration

You can 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. Learn more about how the GDPR affects publishers.

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.

Not setting this indicates that you don't want the ad request to be handled in a manner suitable for users under the age of consent.

Parameters

underAgeOfConsent:Boolean (default = false) — Set to true to indicate that you want ad requests to be handled in a manner suitable for users under the age of consent

Returns
AdRequestBuilderAdRequestBuilder instance for chaining calls