Admob Native Advanced Ad not showing media content?

Viewed 399

I have the ad fetched and all content except mediaView seem to work. Is there anything missing?

class NativeAdAdapterItem(
    private val ad: NativeAd,
) : AdapterItem<NativeAdAdapterItem.ViewHolder>(ad) {

    override fun bind(firstTime: Boolean, holder: ViewHolder) = holder.bind(ad)

    override fun getLayoutId() = R.layout.native_ad_item

    override fun equals(other: Any?): Boolean = other as? InviteFriendsAdapterItem != null

    class ViewHolder(itemView: View) : RecyclerAdapterViewHolder(itemView) {

        private val binding = NativeAdItemBinding.bind(itemView)

        fun bind(ad: NativeAd) {
            binding.adHeadline.text = ad.headline
            binding.adMedia.setMediaContent(ad.mediaContent)
            binding.adMedia.setImageScaleType(ImageView.ScaleType.CENTER_CROP)
            binding.adAdvertiser.text = ad.advertiser
            binding.adIcon.setImageDrawable(ad.icon.drawable)
            binding.adCallToAction.text = ad.callToAction
            binding.adBody.text = ad.body
            binding.adView.setNativeAd(ad)
        }
    }
}

I made the background color of the MediaView green to make sure it's visible on the screen.

The AdView is added to a collectionView

enter image description here

0 Answers
Related