admob_flutter
admob_flutter copied to clipboard
on setState method
banner keeps on refreshing while calling setstate. how to prevent this? i have very low matched rate.
I don't think there is a way to prevent this. @glennmichaelmejias Can you confirm @kmcgill88 ?
@glennmichaelmejias to the best of my knowledge every time a render occurs a new banner view is created. I'd have to see your widget hierarchy but you will want to wrap the banner in your own stateful widget so it isn't rebuilt.
Admob best practice says basically keep the banner ad fixed to the top or bottom of the screen and the ad area should be fixed. Implementing this approach typically means only having 1 instance of the banner.
As an example, I've implemented this in a prior project, McAdViewController, which is a native AdMob solution for iOS. This keeps the single banner instance throughout the life of the app. Even when you transition to different screens.
I'm working on a project now that I'd like to implement this idea into admob_flutter
since this is a common question here and I need it 😄.
@EliasDeuss what do you think about this idea? Instead of MaterialApp
or CupertinoApp
I plan on creating an AdmobApp
or something like that, that will handle a single instance of the banner.
@glennmichaelmejias @EliasDeuss @YoussefKababe check out this proof of concept for keeping a single instance of your banner ad in an app. The state is kept at the very top of the app so it should never be re-rendered. Ads can just cycle through.
For feeds, the cool thing is that you have more than one ad. In my opinion, only a pinned ad can affect earnings, am I sure of that?
Is the banner can create invalid impressions or invalid activity that can cause account to be suspended? I am afraid that this will create invalid impressions because of multiple banners in one app. I am also using this plugin with my app for more than 2 weeks and I can earned $10 with 50k impressions and 1.5k users/installs a day.
just don't declare it inside a build function. it will just recreating every build function triggers or setState