Skip to content

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

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

hellohuanlin
Copy link
Contributor

@hellohuanlin hellohuanlin commented May 12, 2025

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):
Screenshot 2025-05-12 at 3 27 50 PM

No recycle for comparison:
Screenshot 2025-05-12 at 3 27 56 PM

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.

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • My PR includes unit or integration tests for all changed/updated/fixed behaviors (See Contributor Guide).
  • All existing and new tests are passing.
  • I updated/added relevant documentation (doc comments with ///).
  • The analyzer (flutter analyze) does not report any problems on my PR.
  • I read and followed the Flutter Style Guide.
  • I signed the CLA.
  • I am willing to follow-up on review comments in a timely manner.

Breaking Change

Does your PR require plugin users to manually update their apps to accommodate your change?

  • Yes, this is a breaking change (please indicate a breaking change in CHANGELOG.md and increment major revision).
  • No, this is not a breaking change.

@hellohuanlin hellohuanlin marked this pull request as ready for review May 12, 2025 22:26
@malandr2 malandr2 requested review from LTPhantom and malandr2 May 13, 2025 21:54
@hellohuanlin hellohuanlin requested a review from LTPhantom May 14, 2025 22:57
Copy link
Collaborator

@LTPhantom LTPhantom left a 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.

@hellohuanlin hellohuanlin requested a review from LTPhantom May 29, 2025 21:51
Copy link
Collaborator

@LTPhantom LTPhantom left a 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.

@hellohuanlin hellohuanlin force-pushed the example_multi_adaptive_banners_recycle branch from e2884a1 to c38ee7e Compare June 2, 2025 18:09
@hellohuanlin hellohuanlin requested a review from LTPhantom June 2, 2025 18:09
@hellohuanlin
Copy link
Contributor Author

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.

Updated. Could you kick off the CI run again? Thanks!

@malandr2 malandr2 self-requested a review June 13, 2025 14:32
@ycv005
Copy link

ycv005 commented Jun 17, 2025

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

Copy link
Collaborator

@malandr2 malandr2 left a 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);
Copy link
Collaborator

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(
Copy link
Collaborator

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 = [];
Copy link
Collaborator

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants