-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ad_mob] dispose does not dispose BannerAd if called before being loaded on Android #96
Comments
By managing the loaded state of the ads, I manage to get it to work correctly on Android, but on iOS, calling dispose appears to pop banners off a stack, rather than popping the one for which a reference is provided. |
@LouisParkin how did you solve this by managing the state? |
@hesyar I posted one of my dart files here: https://gist.github.com/LouisParkin/9e669b533f404c940d256fdb9af87afe |
@LouisParkin thanks a lot ;) I will check this in the evening |
Another race condition: #669 |
The |
Describe the bug
On Android, If
BannerAd.dispose()
is called quickly after theBannerAd.show()
is called, the banner might still be shown and can never be hiddenTo Reproduce
It is easier to reproduce by code (simple call
show()
thendispose()
) but the example app should be enoughSteps to reproduce the behavior:
flutter run
) AdMob example app, can be on an emulator using test ads (although easier to reproduce on real device)Expected behavior
Calling
dispose()
should dispose the ad and prevent it from being shown later.Additional context
There seems to be an edge case condition in Android state machine where the ad view can be inserted in the tree once loaded - although
adView.destroy() [java]
has been called - but maybe that is not enough, some Android aps also hide the view (maybe add a new destroyed state to handle if the ad gets loaded later to prevent adding the child adView).The workaround I have currently is that I wait (30s) for any event (loaded/load failure) before calling dispose on the dart land.
I have not tested on iOS (or at least not seen such issue)
If needed, I can work on a fix (just add this new destroyed state on Android) and submit a PR, let me know
The text was updated successfully, but these errors were encountered: