Преглед на файлове

Set body(textview) of native ad view unclickable

Wayne преди 4 години
родител
ревизия
16934f9c57
променени са 1 файла, в които са добавени 4 реда и са изтрити 1 реда
  1. 4 1
      src/main/java/com/kdanmobile/admanager/admob/AdmobNativeAdManager.kt

+ 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 }