Mapping class for Google AdMob native ads.
Mediation adapters that load a native ad must extend this class to provide a mapping from
the mediated ad network's native ad object toNativeAd
.
Public Constructor Summary
Public Method Summary
View |
getAdChoicesContent()
Returns the view being used as AdChoices content.
|
finalString |
getAdvertiser()
Returns the text that identifies the advertiser.
|
finalString |
getBody()
Returns body text.
|
finalString |
getCallToAction()
Returns the text that encourages the user to take some action with the ad.
|
float |
getCurrentTime()
Gets the video's current time.
|
float |
getDuration()
Gets the video's duration.
|
finalBundle |
getExtras()
Returns the bundle of extras passed in via the setExtras method.
|
finalString |
getHeadline()
Returns the primary text headline.
|
finalNativeAd.Image |
getIcon()
Returns a small image identifying the advertiser.
|
finalList<NativeAd.Image> |
getImages()
Returns a list of large images.
|
float |
getMediaContentAspectRatio()
Returns the aspect ratio of the media to be rendered in the
MediaView .
|
final boolean |
getOverrideClickHandling()
Returns true if the ad network does click handling on its own.
|
final boolean |
getOverrideImpressionRecording()
Returns true if the ad network does impression tracking on its own.
|
finalString |
getPrice()
For ads about apps, returns a string representing how much the app costs.
|
finalDouble |
getStarRating()
For ads about apps, returns a star rating from 0 to 5 representing how many
stars the app has in the store offering it.
|
finalString |
getStore()
For ads about apps, returns the name of the store offering the app for
download.
|
void |
handleClick(Viewview)
Subclasses should implement this method if the network requires the developer
to explicitly handle click events of views rendered to screen.
|
boolean |
hasVideoContent()
Returns true if the current ad has video content.
|
void |
recordImpression()
Subclasses should implement this method if the network requires the developer
to explicitly record an impression of a view rendered to screen.
|
void | |
final void | |
final void | |
final void | |
final void | |
void |
setHasVideoContent(boolean hasVideoContent)
Set to true if the current ad has video content.
|
final void | |
final void | |
final void | |
void |
setMediaContentAspectRatio(float mediaContentAspectRatio)
Sets the aspect ratio of the media to be rendered in the
MediaView .
|
void | |
final void |
setOverrideClickHandling(boolean overrideClickHandling)
Set to true if the ad network does click handling on its own.
|
final void |
setOverrideImpressionRecording(boolean overrideImpressionRecording)
Set to true if the ad network does impression tracking on its own.
|
final void | |
final void |
setStarRating(DoublestarRating)
For ads about apps, sets a star rating from 0 to 5 representing how many stars
the app has in the store offering it.
|
final void | |
void | |
void |
untrackView(Viewview)
Subclasses should implement this method if the mediated network's SDK offers a
way to stop tracking a native ad view for the ad mapped by this object.
|
Inherited Method Summary
Public Constructors
publicNativeAdMapper()
Public Methods
publicViewgetAdChoicesContent()
Returns the view being used as AdChoices content.
public finalStringgetAdvertiser()
Returns the text that identifies the advertiser.
public finalStringgetBody()
Returns body text.
public finalStringgetCallToAction()
Returns the text that encourages the user to take some action with the ad.
public floatgetCurrentTime()
Gets the video's current time. Returns zero by default. Subclasses should override this method to return a nonzero current time for video ads.
public floatgetDuration()
Gets the video's duration. Returns zero by default. Subclasses should override this method to return a nonzero duration for video ads.
public finalBundlegetExtras()
Returns the bundle of extras passed in via the setExtras method.
public finalStringgetHeadline()
Returns the primary text headline.
public finalNativeAd.Image getIcon()
Returns a small image identifying the advertiser.
public finalList<NativeAd.Image> getImages()
Returns a list of large images.
public floatgetMediaContentAspectRatio()
Returns the aspect ratio of the media to be rendered in theMediaView
.
Returns zero if the aspect ratio is not available.
public final booleangetOverrideClickHandling()
Returns true if the ad network does click handling on its own.
public final booleangetOverrideImpressionRecording()
Returns true if the ad network does impression tracking on its own.
public finalStringgetPrice()
For ads about apps, returns a string representing how much the app costs.
public finalDoublegetStarRating()
For ads about apps, returns a star rating from 0 to 5 representing how many stars the app has in the store offering it.
public finalStringgetStore()
For ads about apps, returns the name of the store offering the app for download. For example, "Google Play".
public voidhandleClick(Viewview)
Subclasses should implement this method if the network requires the developer to explicitly handle click events of views rendered to screen.
public booleanhasVideoContent()
Returns true if the current ad has video content.
public voidrecordImpression()
Subclasses should implement this method if the network requires the developer to explicitly record an impression of a view rendered to screen.
public voidsetAdChoicesContent(View adChoicesContent)
Sets a view to be used as AdChoices content.
public final voidsetAdvertiser(String advertiser)
Sets a text that identifies the advertiser. Apps are not required to display this asset, though it's recommended.
Parameters
advertiser | The text to set |
---|
public final voidsetBody(Stringbody)
Sets body text. Apps are not required to display this asset, though it's recommended.
Parameters
body | The description to set |
---|
public final voidsetCallToAction(String callToAction)
Sets the ad's call to action (such as "Buy" or "Install" ). Apps are not required to display this asset, though it's recommended.
Parameters
callToAction | The text to set |
---|
public final voidsetExtras(Bundleextras)
Sets a bundle of extras containing assets or attributes that do not directly map to those expected for a Google native ad object (headline, body, etc).
public voidsetHasVideoContent(boolean hasVideoContent)
Set to true if the current ad has video content.
public final voidsetHeadline(Stringheadline)
Sets the primary text headline. Apps are required to display this asset.
public final voidsetIcon(NativeAd.Image icon)
Sets a small image identifying the advertiser. Apps are not required to display this asset, though it's recommended.
public final voidsetImages(List<NativeAd.Image> images)
Sets a list of large images. Apps are not required to display this asset, though it's recommended.
public voidsetMediaContentAspectRatio(float mediaContentAspectRatio)
Sets the aspect ratio of the media to be rendered in theMediaView
.
Parameters
mediaContentAspectRatio | the aspect ratio to set |
---|
public voidsetMediaView(ViewmediaView)
Sets mediated view that displays media. This is typically the View provided by the mediated SDK to display video content for an ad, but should display an image asset if no video is present. Adapters are expected to set a View for this property for every ad.
public final voidsetOverrideClickHandling(boolean overrideClickHandling)
Set to true if the ad network does click handling on its own.
public final voidsetOverrideImpressionRecording(boolean overrideImpressionRecording)
Set to true if the ad network does impression tracking on its own.
public final voidsetPrice(Stringprice)
For ads about apps, sets a string representing how much the app costs. Apps are not required to display this asset, though it's recommended.
Parameters
price | The string representing how much the app costs. |
---|
public final voidsetStarRating(Double starRating)
For ads about apps, sets a star rating from 0 to 5 representing how many stars the app has in the store offering it. Apps are not required to display this asset, though it's recommended.
public final voidsetStore(Stringstore)
For ads about apps, sets the name of the store offering the app for download. For example, "Google Play". Apps are not required to display this asset, though it's recommended.
Parameters
store | the name of the app store to set |
---|
public voidtrackViews(ViewcontainerView,Map<String,View> clickableAssetViews,Map<String,View> nonclickableAssetViews)
Subclasses should implement this method if the network requires the developer to
prepare state for recording an impression and/or click before a view is rendered to
screen. Find the asset names inNativeAdAssetNames
.
public voiduntrackView(Viewview)
Subclasses should implement this method if the mediated network's SDK offers a way to stop tracking a native ad view for the ad mapped by this object.