Is it safe to set AdView to Visibility.GONE?

933 views
Skip to first unread message

AndreasB

unread,
Jan 31, 2018, 10:43:58 AM1/31/18
to Google Mobile Ads SDK Developers
I couldn't find a clear answer to this - sorry if this is a duplicate or has an obvious answer somewhere.

If I have an AdView that already has an ad loaded into it via
adView.loadAd(adRequest)

is it safe to eventually set this view to INVISIBLE or GONE later, or do I additionally have to make sure that AdMob gets notified about a certain View no longer being in view first? I would assume that this is OK, because an AdView could also be scrolled out of view, or the Activity paused or any other number of things - basically, view visibility needs to be checked by AdMob, anyway(?) - but I'm rather safe than sorry.

mobileadssdk-a...@google.com

unread,
Jan 31, 2018, 2:16:28 PM1/31/18
to AndreasB, Google Mobile Ads SDK Developers
Hi there,

Thanks for reaching out to support. The SDK will be monitoring when the AdView is shown or hidden so this would not be an issue. Make sure you are following our policy guidelines.

Regards,
Deepika Uragayala
Mobile Ads SDK Team
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and Google+ page:
    http://googleadsdeveloper.blogspot.com
    https://plus.google.com/115658573333388777174/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

--

---
You received this message because you are subscribed to the Google Groups "Google Mobile Ads SDK Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-admob-ads-sdk+unsub...@googlegroups.com.
To post to this group, send email to google-admob-ads-sdk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-admob-ads-sdk/58fe3988-de0d-49e3-b102-2bbb72328ffd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ali Zulfuqar

unread,
Aug 1, 2018, 5:48:06 AM8/1/18
to Google Mobile Ads SDK Developers

Hello, may i clarify this?
is it ok if in my app i use below codes?

adView.setEnabled(false);
adView.setVisibility(View.GONE);

i use Admob ads. Inside app i have inapp purchasement implementation. When users make inapp purchasement, the adview visibility is gone. 
Note that in debug the ads not refreshing. - "Ad is not visible. Not refreshing ad. Scheduling ad refresh 60000 milliseconds from now"

is it ok like this?

Thanks

mobileadssdk-a...@google.com

unread,
Aug 1, 2018, 3:21:28 PM8/1/18
to Ali Zulfuqar, Google Mobile Ads SDK Developers
Hi Ali,

You can remove the AdView as well from the View hierarchy or destroy the object if you want to rather than toggling the visibility. This will even free up some resources for your app to better manage the memory rather than letting the SDK trying to refresh the ad but failing since you have hidden it.

Regards,
Deepika Uragayala
Mobile Ads SDK Team
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and Google+ page:
    http://googleadsdeveloper.blogspot.com
    https://plus.google.com/115658573333388777174/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

To unsubscribe from this group and stop receiving emails from it, send an email to google-admob-ads-sdk+unsubscrib...@googlegroups.com.

--

---
You received this message because you are subscribed to the Google Groups "Google Mobile Ads SDK Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-admob-ads-sdk+unsub...@googlegroups.com.
To post to this group, send email to google-admob-ads-sdk@googlegroups.com.

Ali Zulfuqar

unread,
Aug 2, 2018, 12:31:11 AM8/2/18
to Google Mobile Ads SDK Developers
Thanks, i used destroy and its worked
Reply all
Reply to author
Forward
0 new messages