androidkotlinadmob

is it right to set visibility gone for adview? Admob


adview=findViewById(R.id.adView)
val adRequest = AdRequest.Builder().build()
adview.loadAd(adRequest)

I am using this code to load banner ads, but I also have a button that has to make it so it does not show the ads anymore and one solution I found is to write adView.visability=gone to its onclicklistener.

All I want to know if there will be any problems, will admob consider it as an impression if its disappeared anyway?


Solution

  • Update! it is better to use adView.destroy() when you don't want to show the ad, especially the banner one, and when you want to resume it just run the ad loading function.