native_admob_flutter
native_admob_flutter copied to clipboard
loading banner ad before attaching it to widget
Hi,
Is it possible to load the banner ad using the controller before attaching it to widget? I need to show the banner ad only after it is being loaded by the controller. However, I noticed that if I call controller.load(), and then wait until controller.isLoaded becomes true before attaching it to the BannerAd widget, then it fails to load due to timeout.
Thanks
However, I noticed that if I call controller.load(), and then wait until controller.isLoaded becomes true before attaching it to the BannerAd widget, then it fails to load due to timeout.
In the example app, this doesn't fail. Try it!
In the example app you are creating the BannerAd without checking if it the ad was loaded first. I need to have a globa controller, and show the ad in another page or dialog only when controller.isLoaded is true. This does not work
In my case, it works only when I am using NativeAds. It doesn't work if I change to BannerAd, the event.keys.first == BannerAdEvent.loaded never become true.
Hmm.
This happens because of the BannerAd nature. On the native side, we can't store a banner ad and display it using a BannerAdView, we can only store the BannerAdView and load the ad directly into the view. That means the BannerAd needs to be in the screen
See #72
That means the BannerAd needs to be in the screen
@bdlukaa , I appreciate your package, ele tem me ajudado a ganhar muito dinheiro, rs.
I was thinking about one problem that I have. Invalid traffic (tráfego inválido) :( And I think that is because I'm loading one banner for each page of my PageView (with ability to scroll, not fixed on a part of screen, so it means that is a child of each page of PageView). And I was trying to create a single banner for the 5 pages, and I wasn't successful. I'm betting that is it (adding banner into the PageView's childs) because my Ad requests increased by 2x +. Google must have been scared, when my app updated - so they suspended me to find out.
Do you have some example of this? I need to show the same banner for 5 pages of my PageView.
I made an POC with an isolated static class serving the ad, but I found an issue when the ad isn't loaded sucessful, the area don't be invisible (banner as a child of visibility changing its visibility when ad load fails) the widget don't update being invisible, in failure.
I need to show the same banner for 5 pages of my PageView.
Use the same widget, intiializing it in the parent widget. (Tho I'm not sure it would work on a PageView)
Unfortunately the banner ad needs to be in the screen to be loaded, and if you add and remove it to the tree, it'll be loaded again. It's on BannerAd's nature.
I haven't checked any recent admob updates to check if they changed this
Use the same widget, intiializing it in the parent widget. (Tho I'm not sure it would work on a PageView)
I didn't understand how to do it. However, I will do some tests. If i don't succeed, I'll open an issue with a code example so we can talk better and check the possibility of this being done or not 👍🏻