Home > Software engineering >  AdMob -Cannot find an ad network adapter with the name(s): com.google.DummyAdapter
AdMob -Cannot find an ad network adapter with the name(s): com.google.DummyAdapter

Time:12-20

pod 'Google-Mobile-Ads-SDK'
FirebaseAnalytics/AdIdSupport (8.9.1)
Firebase (8.9.1):
Xcode -Version 12.4 (12D4e)
iPad Simulator -12.9 inch 3rd Generation

There is a Flutter thread on this problem enter image description here

code:

// called in ViewDidLoad
func initializeAdMob() {
    
    let adMobKey = "ca-app-pub-3940256099942544/2934735716"
    
    bannerView.adUnitID = adMobKey
    bannerView.rootViewController = self
    bannerView.delegate = self
    
    let adSize = GADCurrentOrientationAnchoredAdaptiveBannerAdSizeWithWidth(frame.size.width)
    bannerView.adSize = adSize
    
    view.addSubview(bannerView)
    bannerView.heightAnchor.constraint(equalToConstant: 50).isActive = true
    bannerView.leadingAnchor.constraint(equalTo: view.leadingAnchor).isActive = true
    bannerView.trailingAnchor.constraint(equalTo: view.trailingAnchor).isActive = true
    bannerView.bottomAnchor.constraint(equalTo: view.safeAreaLayoutGuide.bottomAnchor, constant: -15).isActive = true

    bannerView.load(GADRequest())
}

CodePudding user response:

It only seems to happen in test environments.

I don’t have any issues with my published app.

If you run it on release mode and with the actual id it should work.

The odd thing to was that if I let it sit for a bit the dummy adapter message appears every so often (like it is asking for a new ad) and if you wait long enough it might actually show an ad and then you start getting the dummy message again.

I think it is an Admob server thing and every so often you get a dummy ad.

Also, try using print on the adSize in the bannerViewWillPresentScreen of the delegate, I was getting height = 0 on there too. When I was using fluid as the size. So the banner was there but you can't see it because the height is zero.

  • Related