NativeCustomFormatAd

public interfaceNativeCustomFormatAd

An Ad Manager custom native ad format. Custom (user-defined) native ad formats allow you to define your own variables for traditional native ads. Custom native ad formats let you define and render your own assets, and allows you to define the click behavior of the ad.

Nested Class Summary

interface NativeCustomFormatAd.DisplayOpenMeasurement An interface for open measurement in display ads.
interface NativeCustomFormatAd.OnCustomClickListener Interface definition for a callback to be invoked when a user clicks on a custom native ad format.
interface NativeCustomFormatAd.OnCustomFormatAdLoadedListener Interface definition for a callback to be invoked when a custom native ad format has successfully loaded.

Constant Summary

String ASSET_NAME_VIDEO The asset name associated with the video content returned by getMediaContent().

Public Method Summary

abstract void
destroy()
Destroys the ad object.
abstractList<String>
getAvailableAssetNames()
Returns a list of all available assets.
abstractString
getCustomFormatId()
Returns the custom native ad format's ID as defined in the Ad Manager UI.
abstract NativeCustomFormatAd.DisplayOpenMeasurement
abstractNativeAd.Image
getImage(StringassetName)
Returns an image asset.
abstractMediaContent
getMediaContent()
Returns theMediaContent associated with this ad.
abstractCharSequence
getText(StringassetName)
Returns a string asset of numbers, URLs, or other types other than an image asset.
abstract void
performClick(StringassetName)
Called when the user has clicked on the ad.
abstract void
recordImpression()
Pings impression URLs and records the impression.

Constants

public static finalString ASSET_NAME_VIDEO

The asset name associated with the video content returned by getMediaContent().This is the asset name that will be reported in NativeCustomFormatAd.OnCustomClickListener.onCustomClick(NativeCustomFormatAd, String)when the user clicks on theMediaView containing with the video content returned by getMediaContent().

Constant Value: "_videoMediaView"

Public Methods

public abstract voiddestroy()

Destroys the ad object. No other methods should be called on the ad object after destroy()is called.

public abstractList<String> getAvailableAssetNames()

Returns a list of all available assets.

Returns
  • a list of all available assets, or an empty list if no asset is available.

public abstractStringgetCustomFormatId()

Returns the custom native ad format's ID as defined in the Ad Manager UI.

public abstract NativeCustomFormatAd.DisplayOpenMeasurementgetDisplayOpenMeasurement()

Returns the NativeCustomFormatAd.DisplayOpenMeasurementassociated with this ad.

Returns
  • nullif display open measurement is not available for this ad.

public abstractNativeAd.Image getImage(StringassetName)

Returns an image asset.

Parameters
assetName The name of the asset to be retrieved.
Returns
  • the value of the asset with the asset name, or null if there's no such asset name.

public abstractMediaContent getMediaContent()

Returns theMediaContent associated with this ad.

public abstractCharSequence getText(StringassetName)

Returns a string asset of numbers, URLs, or other types other than an image asset.

Parameters
assetName The name of the asset to be retrieved.
Returns
  • the value of the asset with the asset name, or null if there's no such asset name.

public abstract voidperformClick(StringassetName)

Called when the user has clicked on the ad.

Parameters
assetName The name of the asset that was clicked.

public abstract voidrecordImpression()

Pings impression URLs and records the impression. Called when the ad is first displayed.