NativeAd

public abstract class NativeAd


针对原生广告请求返回的对象。

摘要

嵌套类型

public abstract class NativeAd.AdChoicesInfo

此类已弃用。

使用 com.google.android.gms.ads.nativead.NativeAd.AdChoicesInfo

public abstract class NativeAd.Image

此类已弃用。

使用 com.google.android.gms.ads.nativead.NativeAd.Image

常量

static final String

“广告选项”素材资源的 ID。

公共构造函数

公共方法

abstract void
performClick(Bundle clickData)

此方法已弃用。

使用 performClick

abstract boolean
recordImpression(Bundle impressionData)

此方法已弃用。

使用 recordImpression

abstract void
reportTouchEvent(Bundle touchEventData)

此方法已弃用。

使用 reportTouchEvent

常量

ASSET_ADCHOICES_CONTAINER_VIEW

public static final String ASSET_ADCHOICES_CONTAINER_VIEW = "1098"

“广告选项”素材资源的 ID。

公共构造函数

NativeAd

public NativeAd()

公共方法

performClick

public abstract void performClick(Bundle clickData)

当用户点击广告时调用。广告单元必须位于允许列表中,才能使用此 API。

参数
Bundle clickData

点击发生时应用环境的软件包。如需了解如何构建点击数据 Bundle 的详细信息,请参阅 com.google.android.gms.ads.nativead.NativeAdConstants

recordImpression

public abstract boolean recordImpression(Bundle impressionData)

在首次展示广告时调用。广告单元必须位于允许列表中,才能使用此 API。

参数
Bundle impressionData

发生展示时应用环境的软件包。如需了解如何构建点击数据 Bundle 的详细信息,请参阅 com.google.android.gms.ads.nativead.NativeAdConstants

返回
boolean

如果成功记录展示,则为 true

reportTouchEvent

public abstract void reportTouchEvent(Bundle touchEventData)

在广告上发生触摸事件时调用。广告单元必须位于允许列表中,才能使用此 API。如果您有意使用此功能,请与您的客户经理联系。

参数
Bundle touchEventData

触控事件坐标和时长的 bundle。

touchEventData Bundle 的 JSON 表示法示例:

  {    "x": "100",  // The x-coordinate of the touch event relative to the window.    "y": "50",  // The y-coordinate of the touch event relative to the window.    "duration_millis": "500",  // The amount of millisecond the user pressed on the asset.  }