AdRequest

Document created by david.simerly on Nov 20, 2017Last modified by david.simerly on Apr 3, 2018
Version 4Show Document
  • View in full screen mode

PubMatic SDKs

➤ AdRequest

NativeAdSize

PMAdRendered

PMAdRequest

PMAdRequest.AD_TYPE

PMAdRequest.AWT_OPTION

PMAdRequest.ETHNICITY

PMAdRequest.GENDER

PMAdRequest.HASHING_TECHNIQUE

PMAdRequest.OPERID

PMAdRequest.RS

PMAdSize

PMAdSize

PMBannerAdRequest

PMBannerAdView

PMBannerAdView.BannerAdViewDelegate

PMBannerAdView.BannerAdViewDelegate.
     ActivityListener

PMBannerAdView.BannerAdViewDelegate.
     FeatureSupportHandler

PMBannerAdView.BannerAdViewDelegate.
     InternalBrowserListener

PMBannerAdView.BannerAdViewDelegate.
     RequestListener

PMBannerAdView.BannerAdViewDelegate.
     RichMediaListener

PMBannerImpression

PMBid

PMError

PMImpression

PMInterstitialAd

PMInterstitialAd.InterstitialAdListener

PMInterstitialAd.InterstitialAdListener.
     ActivityListener

PMInterstitialAd.InterstitialAdListener.
     FeatureSupportHandler

PMInterstitialAd.InterstitialAdListener.
     InternalBrowserListener

PMInterstitialAd.InterstitialAdListener.
     RequestListener

PMInterstitialAd.InterstitialAdListener.
     RichMediaListener

PMInterstitialAdRequest

PMLogger

PMLogger.LogListener

PMLogger.PMLogLevel

PMNativeAd

PMNativeAd.Image

PMNativeAd.NativeRequestListener

PMNativeAdRequest

PMNativeAssetRequest

PMNativeAssetResponse

PMNativeDataAssetRequest

PMNativeDataAssetResponse

PMNativeDataAssetTypes

PMNativeImageAssetRequest

PMNativeImageAssetResponse

PMNativeImageAssetTypes

PMNativeTitleAssetRequest

PMNativeTitleAssetResponse

PMPrefetchManager

PMPrefetchManager.PMPrefetchListener

PMPrefetchRequest

PubMaticSDK


PubMatic Android SDK Guide

com.pubmatic.sdk.common

Class AdRequest

java.lang.Object

com.pubmatic.sdk.common.AdRequest

 

Direct Known Subclasses:

PMAdRequest


public abstract class AdRequest
extends java.lang.Object

 

Field Summary

Modifier and TypeField and Description
protected boolean

isAndroidAidEnabled

Indicates whether the Advertising ID is sent in the request.

protected com.pubmatic.sdk.common.CommonConstants.CHANNELmChannel
protected android.content.ContextmContext
protected java.util.Map<java.lang.String, java.util.List<java.lang.String>>

mCustomParams

Lets publisher define custom Ad request parameters via Map.

protected android.location.LocationmLocation
protected PMAdSizemPMAdSize
protected java.lang.StringBuffermPostData
protected com.pubmatic.sdk.common.RRFormattermRRFormatter
protected java.util.Map<java.lang.String, java.lang.String>

mUrlParams

Request URL params.

protected java.lang.StringmUserAgent

 

Constructor Summary

ModifierConstructor and Description
protected

AdRequest(com.pubmatic.sdk.common.CommonConstants.CHANNEL channel)

 

Method Summary

Modifier and TypeMethod and Description
protected voidaddUrlParam(java.lang.String key, java.lang.String value)
abstract booleancheckMandatoryParams()
protected abstract java.lang.String

getAdServerURL()

Returns the base/hostname URL.

PMAdSizegetAdSize() Returns the ad size set from setAdSize()
com.pubmatic.sdk.common.CommonConstants.CHANNELgetChannel()
android.content.ContextgetContext()
java.util.Map<java.lang.String, java.util.List<java.lang.String>>getCustomParams()
abstract com.pubmatic.sdk.common.RRFormattergetFormatter()
android.location.Location

getLocation()

Returns the user's location.

java.lang.StringgetPostData()
java.lang.StringgetRequestUrl()
java.util.Map<java.lang.String, java.lang.String>getUrlParams()
java.lang.StringgetUserAgent()
protected abstract voidinitializeDefaultParams()
booleanisAndroidAidEnabled()
protected voidputPostData(java.lang.String key, java.lang.String value)
void

setAdSize(PMAdSize adSize)

Sets the banner ad size in the ad request to the provided size.

void

setAndroidAidEnabled(boolean isAndroidAidEnabled)

Controls whether the Advertisement ID is sent in the request.

voidsetContext(android.content.Context mContext)
void

setCustomParams(java.lang.String key, java.lang.String value)

Adds custom key-value parameters in the Ad request.

void

setLocation(android.location.Location location)

Set the user's location.

protected voidsetupPostData()
protected voidsetUpUrlParams()
protected voidsetUrlParams(java.util.Map<java.lang.String,java.lang.String> urlParams)
voidsetUserAgent(java.lang.String userAgent)

 

Methods inherited from class java.lang.Object


clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

 

Field Detail


mContext

protected android.content.Context mContext

 

mPostData

protected java.lang.StringBuffer mPostData

 

mLocation

protected android.location.Location mLocation

mPMAdSize

protected PMAdSize mPMAdSize

 

mUserAgent

protected java.lang.String mUserAgent

 

mChannel

protected com.pubmatic.sdk.common.CommonConstants.CHANNEL mChannel

 

mUrlParams

protected java.util.Map<java.lang.String,java.lang.String> mUrlParams

 

Request URL parameters.

 

mCustomParams

protected java.util.Map<java.lang.String,java.util.List<java.lang.String>> mCustomParams

 

Lets publishers define custom Ad request parameters via Map.

 

isAndroidAidEnabled

protected boolean isAndroidAidEnabled

 

Indicates whether Advertising ID or Android ID is sent in the request. Possible values are:

 

Parameters:

True - (default) sends Advertising ID in the request.

False - sends Android ID in the request.

 

mRRFormatter

protected com.pubmatic.sdk.common.RRFormatter mRRFormatter

 

Constructor Detail


AdRequest

protected AdRequest(com.pubmatic.sdk.common.CommonConstants.CHANNEL channel)

 

Method Detail


getFormatter

public abstract com.pubmatic.sdk.common.RRFormatter getFormatter()

 

getAdServerURL

protected abstract java.lang.String getAdServerURL()

 

Returns:

The base/hostname URL.

 

initializeDefaultParams

protected abstract void initializeDefaultParams()

 

checkMandatoryParams

public abstract boolean checkMandatoryParams()

 

setUpUrlParams

protected void setUpUrlParams()

 

setupPostData

protected void setupPostData()>

 

setUrlParams

protected void setUrlParams(java.util.Map<java.lang.String,java.lang.String> urlParams)

 

addUrlParam

protected void addUrlParam(java.lang.String key, java.lang.String value)

 

putPostData

protected void putPostData(java.lang.String key, java.lang.String value)

 

getContext

public android.content.Context getContext()

 

setContext

public void setContext(android.content.Context mContext)

 

setCustomParams

public void setCustomParams(java.lang.String key, java.lang.String value)

 

Adds custom key-value parameters in the Ad request.

 

Parameters:

key - a string that defines the custom key name.

value - a string that defines the custom key value.

 

setAndroidAidEnabled

public void setAndroidAidEnabled(boolean isAndroidAidEnabled)

 

Controls whether the Advertisement ID is sent in the request.

Enabling Limit Ad Tracking always sends the Android device ID instead of the Advertising ID.
Parameters:

isAndroidAidEnabled - a Boolean value. TRUE (default) sends the Advertising ID in the ad request. FALSE sends the vendor ID in the ad request.

 

isAndroidAidEnabled

public boolean isAndroidAidEnabled()

 

Returns:

TRUE by default.

 

getAdSize

public PMAdSize getAdSize()

 

Returns the ad size set using setAdSize().

 

Returns:

The size of a banner ad.

 

setAdSize

public void setAdSize(PMAdSize adSize)

 

Sets the banner ad size in the ad request with the provided size.

 

getUserAgent

public java.lang.String getUserAgent()

 

setUserAgent

public void setUserAgent(java.lang.String userAgent)

 

getUrlParams

public java.util.Map<java.lang.String,java.lang.String> getUrlParams()

 

getRequestUrl

public final java.lang.String getRequestUrl()

 

getPostData

public java.lang.String getPostData()

 

getCustomParams

public java.util.Map<java.lang.String,java.util.List<java.lang.String>> getCustomParams()

 

setLocation

public void setLocation(android.location.Location location)

 

Sets the user's location.

 

Parameters:

location - User's location.

 

getLocation

public android.location.Location getLocation()

 

Returns:

User's location.

 

getChannel

public com.pubmatic.sdk.common.CommonConstants.CHANNEL getChannel()

 

Attachments

    Outcomes