NativeAd

abstract class NativeAd


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

摘要

嵌套类型

abstract class NativeAd.AdChoicesInfo

此类已废弃。

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

abstract class NativeAd.Image

此类已废弃。

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

常量

const String!

广告选择素材资源 ID。

公共构造函数

公共函数

abstract Unit
performClick(clickData: Bundle!)

此函数已废弃。

使用 performClick

abstract Boolean
recordImpression(impressionData: Bundle!)

此函数已废弃。

使用 recordImpression

abstract Unit
reportTouchEvent(touchEventData: Bundle!)

此函数已废弃。

使用 reportTouchEvent

常量

ASSET_ADCHOICES_CONTAINER_VIEW

const val ASSET_ADCHOICES_CONTAINER_VIEW = "1098": String!

广告选择素材资源 ID。

公共构造函数

NativeAd

NativeAd()

公共函数

performClick

abstract fun performClick(clickData: Bundle!): Unit

在用户点击广告时调用。广告单元必须在许可名单中,才能使用此 API。

参数
clickData: Bundle!

点击发生时应用环境的软件包。如需详细了解如何构建点击数据 Bundle,请参阅。

recordImpression

abstract fun recordImpression(impressionData: Bundle!): Boolean

在广告首次展示时调用。广告单元必须在许可名单中,才能使用此 API。

参数
impressionData: Bundle!

发生展示时应用环境的软件包。如需详细了解如何构建点击数据 Bundle,请参阅。

返回
Boolean

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

reportTouchEvent

abstract fun reportTouchEvent(touchEventData: Bundle!): Unit

在广告上发生触摸事件时调用。广告单元必须列入许可名单,才能使用此 API。如果您有兴趣使用此功能,请与您的客户经理联系。

参数
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.  }