public static final class

AdRequest.Builder

extends Object
java.lang.Object
   ↳ com.google.android.gms.ads.AdRequest.Builder

Class Overview

Builds an AdRequest.

Summary

Public Constructors
AdRequest.Builder()
Public Methods
AdRequest.Builder addKeyword(String keyword)
Add a keyword for targeting purposes.
AdRequest.Builder addNetworkExtras(NetworkExtras networkExtras)
Add extra parameters to pass to a specific ad network adapter.
AdRequest.Builder addTestDevice(String deviceId)
Causes a device to receive test ads.
AdRequest build()
Constructs an AdRequest with the specified attributes.
AdRequest.Builder setBirthday(Date birthday)
Set the user's birthday for targeting purposes.
AdRequest.Builder setGender(int gender)
Set the user's gender for targeting purposes.
AdRequest.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) - http://business.ftc.gov/privacy-and-security/childrens-privacy.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public AdRequest.Builder ()

Public Methods

public AdRequest.Builder addKeyword (String keyword)

Add a keyword for targeting purposes.

public AdRequest.Builder addNetworkExtras (NetworkExtras networkExtras)

Add extra parameters to pass to a specific ad network adapter. networkExtras should be an instance of com.google.ads.mediation.NetworkExtras, which is provided by ad network adapters.

public AdRequest.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.

public AdRequest build ()

Constructs an AdRequest with the specified attributes.

public AdRequest.Builder setBirthday (Date birthday)

Set the user's birthday for targeting purposes.

public AdRequest.Builder setGender (int gender)

Set the user's gender for targeting purposes. This should be GENDER_MALE, GENDER_FEMALE, or GENDER_UNKNOWN.

public AdRequest.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) - http://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.