Quicknav Quicknav
Links

- Google Play Developer Console
- Android Developers Blog
- About Android

Android Sites

- Android.com
- Android Developers
- Android Open Source Project

close

- - Get Started
  - Style
  - Patterns
  - Building Blocks
  - Downloads
  - Videos
- - Training
  - API Guides
  - Reference
  - Tools
    - Get the SDK
  - Google Services
- - Google Play
  - Publishing
  - Promoting
  - App Quality
  - Spotlight
  - Open Distribution

## Results

Loading...
Summary: Ctors | Methods | Inherited Methods | [Expand All]
public static final class

# PublisherAdRequest.Builder

extends Object

java.lang.Object
↳ | com.google.android.gms.ads.doubleclick.PublisherAdRequest.Builder

## Class Overview

Builds a `PublisherAdRequest`.

## Summary

Public Constructors
| PublisherAdRequest.Builder()

Public Methods
PublisherAdRequest.Builder | addKeyword(String keyword) Add a keyword for targeting purposes.
PublisherAdRequest.Builder | addNetworkExtras(NetworkExtras networkExtras) Add extra parameters to pass to a specific ad network adapter.
PublisherAdRequest.Builder | addTestDevice(String deviceId) Causes a device to receive test ads.
PublisherAdRequest | build() Constructs `PublisherAdRequest` with the specified attributes.
PublisherAdRequest.Builder | setBirthday(Date birthday) Sets the user's birthday for targeting purposes.
PublisherAdRequest.Builder | setGender(int gender) Sets the user's gender for targeting purposes.
PublisherAdRequest.Builder | setLocation(Location location) Sets the user's location for targeting purposes.
PublisherAdRequest.Builder | setManualImpressionsEnabled(boolean manualImpressionsEnabled) Enables manual impression reporting.
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 | 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

Object | clone()
boolean | equals(Object arg0)
void | finalize()
final Class<?> | getClass()
int | hashCode()
final void | notify()
final void | notifyAll()
String | toString()
final void | wait()
final void | wait(long arg0, int arg1)
final void | wait(long arg0)

## Public Constructors

#### public PublisherAdRequest.Builder ()

## Public Methods

#### 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. `networkExtras` should be an instance of `com.google.ads.mediation.NetworkExtras`, which is provided by ad network adapters.

#### 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`.

#### public PublisherAdRequest build ()

Constructs `PublisherAdRequest` with the specified attributes.

#### public PublisherAdRequest.Builder setBirthday (Date birthday)

Sets the user's birthday for targeting purposes.

#### public PublisherAdRequest.Builder setGender (int gender)

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

#### public PublisherAdRequest.Builder setLocation (Location location)

Sets the user's location for targeting purposes.

#### public PublisherAdRequest.Builder setManualImpressionsEnabled (boolean manualImpressionsEnabled)

Enables manual impression reporting.

#### 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 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.