capacitor-community / admob

Community plugin for using Google AdMob
MIT License
205 stars 66 forks source link

Support for Banner Ad Preloading #323

Open ecc521 opened 1 week ago

ecc521 commented 1 week ago

Is your feature request related to a problem? Please describe.

Yes. Banner ads can frequently take several seconds to load, which can cause significant visual changes and makes it hard to show banners for a shorter time on intermediate screens. Based on information from the Mobile Ads SDK team, this is policy compliant.

Describe the solution you'd like An option to load a banner ad without displaying. A method to determine if an ad is loaded would also be useful.

Describe alternatives you've considered None.

Additional context I will likely be opening a PR for this in the future, though offer no guarantees.

distante commented 1 week ago

Hello,

This is already supported. Just use the event listeners.

ecc521 commented 1 week ago

@distante I’m extremely confused here - how do I load the banner ad without displaying it immediately?

showBanner is the only function that actually seems to load the ad unit, but it doesn’t provide an option to default the banner to hidden status

distante commented 1 week ago

Oh, you are right, I mixed it up with the interstitial and reward ad.

This will need to be implemented in a backwards compatible way.

That is, showBanner should behave the same as before, unless we give an optional bannerAdId property.

When the property is set, it will be used to show the ad, if not, a new one will be loaded.