NativeAdData

interface NativeAdData {
    /**
     * Returns the title of native ad.
     *
     * @return String with title asset of the ad, or null if it is not available.
     */
    val title: String?

    /**
     * Returns the description of native ad.
     *
     * @return String with description asset of the ad, or null if it is not available.
     */
    val description: String?

    /**
     * Returns the call to action of native ad.
     *
     * @return String with call to action asset of the ad, or null if it is not available.
     */
    val callToAction: String?

    /**
     * Returns the URL of the image asset of native ad.
     *
     * @return String with URL of the image asset of the ad, or null if it is not available.
     */
    val imageUrl: String?

    /**
     * Returns the URL of the icon asset of native ad.
     *
     * @return String with URL of the icon asset of the ad, or null if it is not available.
     */
    val iconUrl: String?

    /**
     * Returns the rating asset of native ad.
     *
     * @return NativeAdRating instance containing both value and scale of rating, or null if it is not available.
     */
    val rating: NativeAdRating?

    /**
     * Returns the view with branding logo or ad information related to the ad network providing the native ad. Some networks like Facebook Audience Network require this special view to be visible on native ads.
     *
     * @return View that should be added to native ad layout, or null if it is not available.
     */
    val brandingLogo: View?

    /**
     * Returns the advertiser asset of native ad (not the same as ad network providing it).
     *
     * @return String with advertiser asset of the ad, or null if it is not available.
     */
    val advertiser: String?

    /**
     * Returns the ad network providing given native ad
     *
     * @return Enum value representing the ad network providing the ad.
     */
    val network: AdNetwork

    /**
     * Returns if the native ad has expired and shall no longer be used.
     *
     * @return True if native ad has expired, false otherwise.
     */
    val isExpired: Boolean

    /**
     * Returns if the native ad is ready to be displayed.
     *
     * @return True if native ad is ready, false otherwise.
     */
    val isReady: Boolean

    /**
     * Binds the native ad instance with given ViewGroup. Needed for click handling and tracking.
     *
     * @param layout        ViewGroup used to render the native ad.
     * @param mainImageView View used to show the main image of the ad. Can be null.
     * @param iconView      View used to show the icon of the native ad.
     * @param ctaView       View used to show the Call To Action of the native ad. Can be null.
     */
    fun attachToLayout(layout: ViewGroup, mainImageView: View?, iconView: View?, ctaView: View?)

    /**
     * Removes the binding between native ad and ViewGroup. Should be called when the native ad will no longer be presented and should be destroyed.
     */
    fun detachFromLayout()
}

See also NativeAdRating which represents the native ad rating.

Last updated