public class AdConfig

  1. Object
  2. AdConfig
Configuration passed once to AdManager.initialize(AdConfig, AdCallback). Controls test mode and the global compliance flags every modern ad network requires (child directed treatment, under-age-of-consent treatment and a maximum ad content rating).

Fields

public static final int TAG_UNSPECIFIED = 0Unspecified child directed treatment (let the network decide).
public static final int TAG_TRUE = 1Tag requests as directed to children (COPPA).
public static final int TAG_FALSE = 2Tag requests as not directed to children.
public static final int RATING_G = 1Content rating: general audiences.
public static final int RATING_PG = 2Content rating: parental guidance.
public static final int RATING_T = 3Content rating: teen.
public static final int RATING_MA = 4Content rating: mature audiences.
public static final int RATING_UNSPECIFIED = 0Content rating: unspecified (network default).

Constructors

public AdConfig()

Methods

public boolean isTestMode()When true the provider serves test ads on every device (in addition to any explicit getTestDeviceIds()).
public AdConfig testMode(boolean testMode)Enables or disables global test mode.
public AdConfig addTestDevice(String deviceId)Registers a device hash that should always receive test ads.
public List<String> getTestDeviceIds()The registered test device hashes, never null.
public String getTestDeviceIdString()The test device hashes as a comma separated string for native bridges.
public int getTagForChildDirectedTreatment()Child directed treatment flag, one of TAG_UNSPECIFIED, TAG_TRUE, TAG_FALSE.
public AdConfig tagForChildDirectedTreatment(int tag)Sets the child directed treatment flag (COPPA).
public int getTagForUnderAgeOfConsent()Under age of consent flag, one of TAG_UNSPECIFIED, TAG_TRUE, TAG_FALSE.
public AdConfig tagForUnderAgeOfConsent(int tag)Sets the under-age-of-consent flag, used by AdConsent when gathering GDPR consent.
public int getMaxAdContentRating()The maximum ad content rating, one of the RATING_* constants.
public AdConfig maxAdContentRating(int rating)Caps the content rating of served ads.

Inherited methods

Field details

TAG_UNSPECIFIED

public static final int TAG_UNSPECIFIED = 0
Unspecified child directed treatment (let the network decide).

TAG_TRUE

public static final int TAG_TRUE = 1
Tag requests as directed to children (COPPA).

TAG_FALSE

public static final int TAG_FALSE = 2
Tag requests as not directed to children.

RATING_G

public static final int RATING_G = 1
Content rating: general audiences.

RATING_PG

public static final int RATING_PG = 2
Content rating: parental guidance.

RATING_T

public static final int RATING_T = 3
Content rating: teen.

RATING_MA

public static final int RATING_MA = 4
Content rating: mature audiences.

RATING_UNSPECIFIED

public static final int RATING_UNSPECIFIED = 0
Content rating: unspecified (network default).

Constructor details

AdConfig

public AdConfig()

Method details

isTestMode

public boolean isTestMode()
When true the provider serves test ads on every device (in addition to any explicit getTestDeviceIds()). Never ship a release build with test mode on or you will violate the ad network’s program policies, and never click live ads during development.

testMode

public AdConfig testMode(boolean testMode)
Enables or disables global test mode.

addTestDevice

public AdConfig addTestDevice(String deviceId)
Registers a device hash that should always receive test ads. The hash is printed to the device log by the underlying SDK the first time an ad loads.

getTestDeviceIds

public List<String> getTestDeviceIds()
The registered test device hashes, never null.

getTestDeviceIdString

public String getTestDeviceIdString()
The test device hashes as a comma separated string for native bridges.

getTagForChildDirectedTreatment

public int getTagForChildDirectedTreatment()
Child directed treatment flag, one of TAG_UNSPECIFIED, TAG_TRUE, TAG_FALSE.

tagForChildDirectedTreatment

public AdConfig tagForChildDirectedTreatment(int tag)
Sets the child directed treatment flag (COPPA).

getTagForUnderAgeOfConsent

public int getTagForUnderAgeOfConsent()
Under age of consent flag, one of TAG_UNSPECIFIED, TAG_TRUE, TAG_FALSE.

tagForUnderAgeOfConsent

public AdConfig tagForUnderAgeOfConsent(int tag)
Sets the under-age-of-consent flag, used by AdConsent when gathering GDPR consent.

getMaxAdContentRating

public int getMaxAdContentRating()
The maximum ad content rating, one of the RATING_* constants.

maxAdContentRating

public AdConfig maxAdContentRating(int rating)
Caps the content rating of served ads.