Class AdRequest
java.lang.Object
com.codename1.ads.AdRequest
public class AdRequest
extends java.lang.Object
Optional targeting metadata attached to an ad load. Build one with the fluent setters and pass it to a load method, or omit it entirely to load with defaults:
interstitial.load(new AdRequest()
.addKeyword("games")
.contentUrl("https://example.com/level"));
An AdRequest is immutable once a load begins; reuse or discard freely.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddKeyword(String keyword) Adds a keyword used to target the ad.contentUrl(String contentUrl) Sets a URL describing the content the ad will appear next to, used for brand safety and contextual targeting.The content URL associated with this request, may be null.The keywords associated with this request, never null.The keywords as a comma separated string, used by native bridges.booleanTrue when non personalized ads were explicitly requested.nonPersonalized(boolean nonPersonalized) Requests non-personalized ads regardless of the user's consent state.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
AdRequest
public AdRequest()
-
-
Method Details
-
addKeyword
-
getKeywords
-
getKeywordString
The keywords as a comma separated string, used by native bridges. Returns an empty string when no keywords were set. -
contentUrl
-
getContentUrl
The content URL associated with this request, may be null. -
nonPersonalized
Requests non-personalized ads regardless of the user's consent state. This is normally driven automatically by
AdConsent; set it explicitly only when you have your own consent mechanism.Parameters
nonPersonalized: true to request non personalized ads
Returns
this request for chaining
-
isNonPersonalized
public boolean isNonPersonalized()True when non personalized ads were explicitly requested.
-