Android APIs
public interface

NativeCustomTemplateAd

com.google.android.gms.ads.formats.NativeCustomTemplateAd

Class Overview

A native custom template ad. In addition to NativeContentAd and NativeAppInstallAd, custom templates let you define and render your own assets, and allows you to define the click behavior of the ad.

Summary

Nested Classes
interface NativeCustomTemplateAd.OnCustomClickListener An interface defining a callback that is called when a user clicks on a custom template native ad that has a custom click action. 
interface NativeCustomTemplateAd.OnCustomTemplateAdLoadedListener An interface defining a callback that is called when a native custom template ad is loaded. 
Public Methods
abstract List<String> getAvailableAssetNames()
Returns a list of all available assets.
abstract String getCustomTemplateId()
Returns the ID of the custom template used to request this ad.
abstract NativeAd.Image getImage(String assetName)
Returns an image asset.
abstract CharSequence getText(String assetName)
Returns a string asset of numbers, URLs, or other types other than an image asset.
abstract void performClick(String assetName)
Called when the user has clicked on the ad.
abstract void recordImpression()
Ping impression URLs and record the impression.

Public Methods

public abstract List<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 abstract String getCustomTemplateId ()

Returns the ID of the custom template used to request this ad.

public abstract NativeAd.Image getImage (String assetName)

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 abstract CharSequence getText (String assetName)

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 void performClick (String assetName)

Called when the user has clicked on the ad.

Parameters
assetName The name of the asset that is performed the click.

public abstract void recordImpression ()

Ping impression URLs and record the impression. Called when the ad is first displayed.