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

  • Got the answer, the right thing to do is to write adView.visability=gone and adview.pause() and if you want the banner to appear again you write adview.visibility=View.VISIBLE and adview.resume()