Sam
Sam

Reputation: 3064

Flutter banner ad not sticking at the bottom

I have an Android app that uses Google Admob for showing ads. I have below two issues which I tried a lot but not getting resolved.

  1. Even though I have provided my actual Ad mob app id and Ad unit id, it shows Test ad at the top of the ad.
  2. The ad is not sticking at the bottom of the screen instead it is 1 inch above the bottom of the screen (screenshot)

Code for the Ad.

BannerAd buildBanner() {
bannerAd = BannerAd(
  adUnitId: AD_MOB_AD_ID, // My Actual banned ad unit id
  targetingInfo: targetingInfo,
  size: AdSize.smartBanner
      listener: (MobileAdEvent event) {

  });
return bannerAd;
}

To show the ad

  FirebaseAdMob.instance.initialize(appId: AD_MOB_APP_ID); // Actual Ad mob app id
  bannerAd = buildBanner()..load();

enter image description here

Upvotes: 0

Views: 1611

Answers (1)

Apin
Apin

Reputation: 2668

Here my code to show my Ads

_bannerAd = BannerAd(
    adUnitId: BannerAd.testAdUnitId,
    size: AdSize.smartBanner,
    targetingInfo: targetingInfo,
    listener: (event) {
        if (event == MobileAdEvent.loaded) {
        _bannerAd.show(anchorOffset: 0.0, anchorType: AnchorType.bottom);
        }
    })
    ..load();

Upvotes: 2

Related Questions