From 1ada808c165e4c84ff10e7575572d32d54268b3c Mon Sep 17 00:00:00 2001 From: Mustafa Ozhan Date: Sat, 30 Nov 2024 12:32:26 +0100 Subject: [PATCH] [Oztechan/CCC#4098] Add Logs for banner ad failed requests for Android --- .../com/oztechan/ccc/android/core/ad/AdManagerImpl.kt | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/android/core/ad/src/google/kotlin/com/oztechan/ccc/android/core/ad/AdManagerImpl.kt b/android/core/ad/src/google/kotlin/com/oztechan/ccc/android/core/ad/AdManagerImpl.kt index 1c3590a4b..da75bb3be 100644 --- a/android/core/ad/src/google/kotlin/com/oztechan/ccc/android/core/ad/AdManagerImpl.kt +++ b/android/core/ad/src/google/kotlin/com/oztechan/ccc/android/core/ad/AdManagerImpl.kt @@ -5,6 +5,7 @@ import android.content.Context import android.os.Build import android.view.WindowManager import co.touchlab.kermit.Logger +import com.google.android.gms.ads.AdListener import com.google.android.gms.ads.AdRequest import com.google.android.gms.ads.AdSize import com.google.android.gms.ads.AdView @@ -112,6 +113,14 @@ internal class AdManagerImpl(context: Context) : AdManager { val adView = AdView(context).apply { setAdSize(finalAdSize) adUnitId = adId + adListener = object : AdListener() { + override fun onAdFailedToLoad(adError: LoadAdError) { + super.onAdFailedToLoad(adError) + Exception("AdManagerImpl getBannerAd onAdFailedToLoad ${adError.message}").let { + Logger.e(it) { it.message.orEmpty() } + } + } + } loadAd(adRequest) }