com.google.ads.mediation
Class MediationAdRequest

java.lang.Object
  extended by com.google.ads.mediation.MediationAdRequest

public class MediationAdRequest
extends Object

Information about the ad to fetch for a single publisher. The information is passed through to the ad network's adapter.


Constructor Summary
MediationAdRequest(AdRequest request, Context context, boolean shareLocation)
          Creates a new MediationAdRequest from an existing AdRequest
 
Method Summary
 Integer getAgeInYears()
          Calculates the age of the user in years, if the birthday is defined by the AdRequest.
 Date getBirthday()
          Gets the birthday of the user, if defined by the AdRequest
 AdRequest.Gender getGender()
          Gets the gender of the user, if defined by the AdRequest
 Set<String> getKeywords()
          Gets a set of keywords requested by the user, if defined by the AdRequest
 Location getLocation()
          Gets the physical location of the user, if defined by the AdRequest and allowed to be shared by the publisher.
 boolean isTesting()
          Gets a flag determining whether the publisher is asking for test ads.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MediationAdRequest

public MediationAdRequest(AdRequest request,
                          Context context,
                          boolean shareLocation)
Creates a new MediationAdRequest from an existing AdRequest

Parameters:
request - Ad request parameters (null not allowed)
context - Android Context the ad is running under. If this is null, then isTesting() will always return true.
shareLocation - Whether to share location from 'request' with ad networks. If true, getLocation() returns the location from 'request', if false, getLocation() returns null.
Method Detail

getGender

public AdRequest.Gender getGender()
Gets the gender of the user, if defined by the AdRequest


getBirthday

public Date getBirthday()
Gets the birthday of the user, if defined by the AdRequest


getAgeInYears

public Integer getAgeInYears()
Calculates the age of the user in years, if the birthday is defined by the AdRequest. This rounds the user's age down. The exact age may be off by up to a day. If a more accurate age is needed, the actual birth date is provided via getBirthday().


getKeywords

public Set<String> getKeywords()
Gets a set of keywords requested by the user, if defined by the AdRequest


getLocation

public Location getLocation()
Gets the physical location of the user, if defined by the AdRequest and allowed to be shared by the publisher.


isTesting

public boolean isTesting()
Gets a flag determining whether the publisher is asking for test ads. Publishers request test ads by specifying a device ID, but this information is resolved to a boolean for convenience. If no Context was provided to this class' constructor, this will always return true.