Class AdConfig
java.lang.Object
com.codename1.ads.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).-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intContent rating: general audiences.static final intContent rating: mature audiences.static final intContent rating: parental guidance.static final intContent rating: teen.static final intContent rating: unspecified (network default).static final intTag requests as not directed to children.static final intTag requests as directed to children (COPPA).static final intUnspecified child directed treatment (let the network decide). -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddTestDevice(String deviceId) Registers a device hash that should always receive test ads.intThe maximum ad content rating, one of theRATING_*constants.intintThe registered test device hashes, never null.The test device hashes as a comma separated string for native bridges.booleanWhen true the provider serves test ads on every device (in addition to any explicitgetTestDeviceIds()).maxAdContentRating(int rating) Caps the content rating of served ads.tagForChildDirectedTreatment(int tag) Sets the child directed treatment flag (COPPA).tagForUnderAgeOfConsent(int tag) Sets the under-age-of-consent flag, used byAdConsentwhen gathering GDPR consent.testMode(boolean testMode) Enables or disables global test mode.
-
Field Details
-
TAG_UNSPECIFIED
public static final int TAG_UNSPECIFIEDUnspecified child directed treatment (let the network decide).- See Also:
-
TAG_TRUE
public static final int TAG_TRUETag requests as directed to children (COPPA).- See Also:
-
TAG_FALSE
public static final int TAG_FALSETag requests as not directed to children.- See Also:
-
RATING_G
public static final int RATING_GContent rating: general audiences.- See Also:
-
RATING_PG
public static final int RATING_PGContent rating: parental guidance.- See Also:
-
RATING_T
public static final int RATING_TContent rating: teen.- See Also:
-
RATING_MA
public static final int RATING_MAContent rating: mature audiences.- See Also:
-
RATING_UNSPECIFIED
public static final int RATING_UNSPECIFIEDContent rating: unspecified (network default).- See Also:
-
-
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 explicitgetTestDeviceIds()). 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
Enables or disables global test mode. -
addTestDevice
-
getTestDeviceIds
-
getTestDeviceIdString
The test device hashes as a comma separated string for native bridges. -
getTagForChildDirectedTreatment
public int getTagForChildDirectedTreatment() -
tagForChildDirectedTreatment
Sets the child directed treatment flag (COPPA). -
getTagForUnderAgeOfConsent
public int getTagForUnderAgeOfConsent() -
tagForUnderAgeOfConsent
-
getMaxAdContentRating
public int getMaxAdContentRating()The maximum ad content rating, one of theRATING_*constants. -
maxAdContentRating
Caps the content rating of served ads.
-