public class AdRequester
extends java.lang.Object
The AdRequest holds properties for the type of ad that should be returned.
Only ads that meet the criteria set by these properties will be returned. For example, if the genre is set to "ROCK" only ads that have been targeted to this genre will be served.
If no value is set for a property, then that criteria will be ignored during ad selection. For example, if the genre is not set on the AdRequest, but a particular ad is associated with "COUNTRY", that ad may still be served.
Modifier and Type | Method and Description |
---|---|
AdRequester |
addKeyword(java.lang.String keyword)
Adds a keyword related to the ad that is being requested.
|
AdRequester |
adName(java.lang.String adName) |
AdRequester |
genre(java.lang.String genre) |
AdRequester |
length(AdLength length)
Sets the AdLength for the advertisement to be requested.
|
XappAdController |
loadAd(android.content.Context ctx,
LoadCallback<Advertisement> callback)
Preload an ad that will play as an interstitial ad in a new Activity.
|
XappAdController |
loadAd(FragmentManager fm,
int containerId,
LoadCallback<Advertisement> callback)
Preload an ad that will play inside a fragment in the provided container ID.
|
XappAdController |
loadAd(LoadCallback<Advertisement> callback)
Preload an ad that will only be audio only.
|
void |
requestMedia(LoadCallback<MediaAdvertisement> callback)
Asynchronously requesting only the ad itself.
|
AdRequester |
setAsDfpUnit(java.lang.String dfpAdUnit,
java.lang.String dfpNetworkId) |
AdRequester |
showLatestAd(boolean showLatest) |
AdRequester |
stationFormat(java.lang.String stationFormat) |
AdRequester |
unsetAsDfpAdUnit()
Remove items originally noted in
setAsDfpUnit(String, String) . |
AdRequester |
user(UserData user)
Set the user for the request.
|
public AdRequester user(UserData user)
user
- User details for targeting.public AdRequester addKeyword(java.lang.String keyword)
keyword
- The new list of keywords.public AdRequester length(AdLength length)
length
- The AdLength of the advertisement to be requested.public AdRequester genre(java.lang.String genre)
genre
- The genre of the advertisement to be requested.public AdRequester stationFormat(java.lang.String stationFormat)
stationFormat
- The station format of the advertisement to be requested.public AdRequester showLatestAd(boolean showLatest)
showLatest
- True if you want to request the latest advertisement, false otherwise.public AdRequester adName(java.lang.String adName)
adName
- The name of the advertisement to be requested.public AdRequester setAsDfpUnit(java.lang.String dfpAdUnit, java.lang.String dfpNetworkId)
dfpAdUnit
- The adUnit to resolve the ad requests againstdfpNetworkId
- The network id to resolve the ad requests againstpublic AdRequester unsetAsDfpAdUnit()
setAsDfpUnit(String, String)
.public void requestMedia(LoadCallback<MediaAdvertisement> callback)
callback
- Callback which will retrieve the ad. Can not be null.public XappAdController loadAd(LoadCallback<Advertisement> callback)
XappController.start()
will
play the ad as soon as it is successfully loaded.callback
- Optional callback to know when the ad is loaded or if it there was an error downloading the ad.public XappAdController loadAd(FragmentManager fm, int containerId, LoadCallback<Advertisement> callback)
XappController.start()
will play the ad as soon as it is successfully loaded.fm
- Fragment manager that the Xapp Fragment will reside.containerId
- View container Id that will contain the Xapp.callback
- Optional callback to know when the ad is loaded or if there was an error downloading the ad.public XappAdController loadAd(android.content.Context ctx, LoadCallback<Advertisement> callback)
XappInterstitialActivity
*must*
be registered in the app's Manifest to use this. Pressing XappController.start()
will play the ad
as soon as it is successfully loaded.ctx
- The Context that will launch from.callback
- Optional callback to know when the ad is loaded or if there was an error downloading the ad.