-
Notifications
You must be signed in to change notification settings - Fork 324
Add multi inline adaptive banner example with recycling #1316
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
base: main
Are you sure you want to change the base?
Add multi inline adaptive banner example with recycling #1316
Conversation
packages/google_mobile_ads/example/lib/multi_adaptive_inline_with_recycle_example.dart
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dart analysis is complaining:
info • Missing documentation for a public member • example/lib/multi_adaptive_inline_with_recycle_example.dart:6:7 • public_member_api_docs
info • Missing documentation for a public member • example/lib/multi_adaptive_inline_with_recycle_example.dart:7:9 • public_member_api_docs
info • Unnecessary use of double quotes • example/lib/multi_adaptive_inline_with_recycle_example.dart:26:[11](https://github.com/googleads/googleads-mobile-flutter/actions/runs/15032701390/job/42644443675?pr=1316#step:6:12) • prefer_single_quotes
info • Unnecessary use of double quotes • example/lib/multi_adaptive_inline_with_recycle_example.dart:94:55 • prefer_single_quotes
Please fix.
Samples format error seems unrelated... will need to update on different PR.
packages/google_mobile_ads/example/lib/multi_adaptive_inline_with_recycle_example.dart
Outdated
Show resolved
Hide resolved
packages/google_mobile_ads/example/lib/multi_adaptive_inline_with_recycle_example.dart
Outdated
Show resolved
Hide resolved
packages/google_mobile_ads/example/lib/multi_adaptive_inline_with_recycle_example.dart
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we are almost there. There is just one last format complain. Also, samples format has been fixed. If you sync those errors should disappear.
e2884a1
to
c38ee7e
Compare
Updated. Could you kick off the CI run again? Thanks! |
packages/google_mobile_ads/example/lib/multi_adaptive_inline_with_recycle_example.dart
Outdated
Show resolved
Hide resolved
packages/google_mobile_ads/example/lib/multi_adaptive_inline_with_recycle_example.dart
Outdated
Show resolved
Hide resolved
packages/google_mobile_ads/example/lib/multi_adaptive_inline_with_recycle_example.dart
Outdated
Show resolved
Hide resolved
packages/google_mobile_ads/example/lib/multi_adaptive_inline_with_recycle_example.dart
Outdated
Show resolved
Hide resolved
packages/google_mobile_ads/example/lib/multi_adaptive_inline_with_recycle_example.dart
Outdated
Show resolved
Hide resolved
packages/google_mobile_ads/example/lib/multi_adaptive_inline_with_recycle_example.dart
Outdated
Show resolved
Hide resolved
Is there any way to preload ads for banner (small, mrec & adaptive). I can found same in applovin sdk - https://developers.axon.ai/en/max/flutter/ad-formats/banner-and-mrec-ads#ad-preloading |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM for DevRel pending changes
size: adSize, | ||
listener: BannerAdListener( | ||
onAdLoaded: (Ad ad) async { | ||
BannerAd bannerAd = (ad as BannerAd); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we include onAdFailed to load callback?
adUnitId: bannerId, | ||
request: const AdRequest(), | ||
size: adSize, | ||
listener: BannerAdListener( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we also include the onAdimpression callback?
class _MultiInlineAdaptiveWithRecycleExampleState | ||
extends State<MultiInlineAdaptiveWithRecycleExample> { | ||
// A list of all the banners created. | ||
final List<BannerAd> _banners = []; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about failed banner ads? Do we need to keep an array of failed banners so the recycler can attempt to retry any failed banners?
Description
This example shows how to do recycling with multiple inline adaptive banners.
It will be linked from the website: https://developers.google.com/admob/flutter/banner/inline-adaptive
Screen recording demo: flutter/flutter#158944 (comment)
Picture showing how recycle works (this PR):

No recycle for comparison:

Related Issues
flutter/flutter#158944
*Replace this paragraph with a list of issues related to this PR from the issue database. Indicate, which of these issues are resolved or fixed by this PR.
Checklist
Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes (
[x]
).This will ensure a smooth and quick review process. Updating the
pubspec.yaml
and changelogs is not required.///
).flutter analyze
) does not report any problems on my PR.Breaking Change
Does your PR require plugin users to manually update their apps to accommodate your change?