Jelajahi Sumber

Set body(textview) of native ad view unclickable

Wayne 4 tahun lalu
induk
melakukan
16934f9c57

+ 4 - 1
src/main/java/com/kdanmobile/admanager/admob/AdmobNativeAdManager.kt

@@ -87,6 +87,10 @@ class AdmobNativeAdManager(private val context: Context) : NativeAdManager {
 
     private fun buildAdView(ad: UnifiedNativeAd, nativeAdViewBinder: NativeAdViewBinder): View {
         return (LayoutInflater.from(context).inflate(nativeAdViewBinder.layout, null) as UnifiedNativeAdView).apply {
+            /**
+             * Only the ad titles, URLs, CTA, and non-background image assets should be clickable.
+             * https://support.google.com/admob/answer/6240814?hl=en&ref_topic=2745287
+             * */
             findViewById<MediaView>(nativeAdViewBinder.mainImageViewId)?.let {
                 mediaView = it
             }
@@ -100,7 +104,6 @@ class AdmobNativeAdManager(private val context: Context) : NativeAdManager {
             }
             findViewById<TextView>(nativeAdViewBinder.textTextViewId)?.let {
                 ad.body?.apply { it.text = this }
-                bodyView = it
             }
             findViewById<Button>(nativeAdViewBinder.ctaButtonId)?.let {
                 ad.callToAction?.apply { it.text = this }