We are preloading collapsible banners during the loading scene and only intend to show them when needed. However, the collapsible banner is being displayed immediately after it finishes loading, even though we haven't requested it to be shown at that time. Ideally, the banner should remain hidden until it is explicitly called to display.
Issue 2: BannerView.Hide() Not Functioning as ExpectedIn an effort to hide the banner, we attempted to use the BannerView.Hide() function, but it does not appear to be working. As a temporary solution, we are using BannerView.Destroy() to remove the banner instead. However, this creates a new issue as it triggers a reload of the collapsible banner, and we have to wait for the reloading process to complete. This causes a delay in determining the next steps and, in some cases, unintentionally triggers the Open Ads, which is not the desired outcome.
I had reproduce these problems in this project, please take a look.
https://github.com/NotthingStudioo/DemoCollapsible
Best regards,
Huy Le,
Hi Huy Le,
Thank you for contacting the Mobile Ads SDK support team.
void Start () { //this give me null reference exeption admob.bannerview.hide(); } void OnDisable () { admob.bannervier.Show(); }
I hope this helps! Let me know if you have any other questions.
Mobile Ads SDK Team |
Hi Mobile Ads SDK support team,
Thank you for your detailed explanation! It helped me solve the first issue. I found that the bannerView.Hide() function works perfectly when I place it at the end of LoadCollapsibleBannerAd().
Regarding the second issue, in the project I provided, there is no scene-changing action involved. I have checked the instance ID of both the GameObject and the hashcode of the BannerView, and they match. This confirms there are no null reference exceptions when trying to hide the banner.
In the provided link, I’ve also included a playable APK. Please try it on your device.
Thank you for your assistance!
Best regards,
Huy Le
Hi Huy Le,
Thank you for confirming that your first issue got fixed.
For the second Issue can you make sure that you are not redeclaring the bannerView as a local variable in any of the methods and try to destroy the Ad
void OnDisable(){
bannerView.Hide(); or bannerview.destroy();
}
Hi,
Thank you for your response.
I can confirm that there is no redeclaration of the bannerView in the provided project, as long as the Destroy button has not been clicked. The instance of collapsibleBannerView is only destroyed when the Destroy button is explicitly clicked. Below is the relevant code from the project:
Thank you for your help!
Best regards,
Huy Le
I will check with our team regarding your query and one of my team members will reach out to you once we have an update on this.
Hi,
Thank you for getting back to us.
I will check with our team regarding your query and one of my team members will reach out to you once we have an update on this. Meanwhile, your patience is highly appreciated.
Hi Huy,
Can you try to hide the banner before loading it? This should tell the SDK to not show the banner when loading completes.
_banner = new BannerView(_adUnitId, AdSize.Banner, AdPosition.Top); _banner.Hide(); var adRequest = new AdRequest.Builder() .AddExtra("collapsible", "top") .Build(); _banner.LoadAd(adRequest);
|