NativeAd

abstract class NativeAd


An object returned for a native ad request.

Summary

Nested types

abstract class NativeAd.AdChoicesInfo

This class is deprecated.

Use com.google.android.gms.ads.nativead.NativeAd.AdChoicesInfo.

abstract class NativeAd.Image

This class is deprecated.

Use com.google.android.gms.ads.nativead.NativeAd.Image.

Constants

const String!

The ad choices asset ID.

Public constructors

Public functions

abstract Unit
performClick(clickData: Bundle!)

This function is deprecated.

Use performClick.

abstract Boolean
recordImpression(impressionData: Bundle!)

This function is deprecated.

Use recordImpression.

abstract Unit
reportTouchEvent(touchEventData: Bundle!)

This function is deprecated.

Use reportTouchEvent.

Constants

ASSET_ADCHOICES_CONTAINER_VIEW

const val ASSET_ADCHOICES_CONTAINER_VIEW = "1098": String!

The ad choices asset ID.

Public constructors

NativeAd

NativeAd()

Public functions

performClick

abstract fun performClick(clickData: Bundle!): Unit

Call when the user has clicked on the ad. The ad unit must be in the allow list to be able to use this api.

Parameters
clickData: Bundle!

bundle of the app environment when the click happens. For details to construct the click data Bundle, see .

recordImpression

abstract fun recordImpression(impressionData: Bundle!): Boolean

Call when the ad is first displayed. The ad unit must be in the allow list to be able to use this api.

Parameters
impressionData: Bundle!

bundle of the app environment when the impression happens. For details to construct the click data Bundle, see .

Returns
Boolean

true if the impression is recorded successfully

reportTouchEvent

abstract fun reportTouchEvent(touchEventData: Bundle!): Unit

Call when a touch event happens on the ad. The ad unit must be in the allow list to be able to use this api. If you are interested in using this feature, reach out to your account manager.

Parameters
touchEventData: Bundle!

bundle of touch event coordinates and duration.

Example JSON representation of touchEventData Bundle:

  {    "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.  }