Reputation: 3064
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.
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();
Upvotes: 0
Views: 1611
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