Triggering onAdImpression in the AD-Mob in android
What I am doing doing
- I have the below code where the AD is Displaying
- I am using google AD-Mob
- AD is displaying fine
What I am trying to understand
onAdImpression()
is not triggered when the view is rendered in the screen instead its triggered when I click the AD, GO to the designated AD and return back to the APP where the AD container is present- Is it supposed to work this way or
onAdImpression()
should be triggered as soon as the AD is rendered on the screen
@Composable fun BannerAdView(adUnitId: String) { val context = LocalContext.current val adView = remember { AdView(context) } AndroidView( factory = { adView.apply { setAdSize(AdSize.BANNER) this.adUnitId = adUnitId adListener = object : AdListener() { override fun onAdLoaded() { // Called when an ad is loaded. } override fun onAdFailedToLoad(error: LoadAdError) { // Called when an ad fails to load. } override fun onAdOpened() { // Called when an ad opens an overlay that covers the screen. } override fun onAdClicked() { // Called when an ad is clicked. } override fun onAdClosed() { // Called when the user is about to return to the app after tapping on an ad. } override fun onAdImpression() { // Called when an ad impression is recorded. Log.d("AdImpression", "Ad impression recorded") } } loadAd(AdRequest.Builder().build()) } }, update = { it.loadAd(AdRequest.Builder().build()) } ) }