Question

I followed the custom event example at developers.google.com, but failed to receive ad from the custom ad network with the error in title.

After I requesting the ad for custom event, requestBannerAd:parameter:label:request: in class CustomAd did get called. But then (a few seconds later), it jumped to adView:didFailToReceiveAdWithError: with following error. And my custom network ad request in requestBannerAd:parameter:label:request: did not work.

Error Domain=com.google.ads Code=9 "Request Error: No ad to show from all configured ad networks." UserInfo=0x1e8e31a0 {NSLocalizedDescription=Request Error: No ad to show from all configured ad networks., NSLocalizedFailureReason=Request Error: No ad to show from all configured ad networks.}

I tries to add [self.delegate customEventBanner:self didReceiveAd:bannerView_]; to requestBannerAd:parameter:label:request:, and then it works.

My question is:

Am I doing it right? Should I call [self.delegate customEventBanner:self didReceiveAd:bannerView_]; manually from requestBannerAd:parameter:label:request:, which is not mentioned in the official doc.

And for the custom event ad request which trigger the requestBannerAd:parameter:label:request: later, should I set gadBannerView_.delegate for it. When I set it, and later successfully receive custom event (requestBannerAd:parameter:label:request: get called), why the adView:didFailToReceiveAdWithError get called but not the adViewDidReceiveAd:?

Was it helpful?

Solution

You do need to call [self.delegate customEventBanner:self didReceiveAd:bannerView_]; at some point in your custom event flow. If you don't do so within about 5 seconds of requestBannerAd:parameter:label:request: being invoked, AdMob Mediation will time out on the request to your custom event and move on. That's why you're seeing the message:

Error Domain=com.google.ads Code=9 "Request Error: No ad to show from all configured ad networks." UserInfo=0x1e8e31a0 {NSLocalizedDescription=Request Error: No ad to show from all configured ad networks., NSLocalizedFailureReason=Request Error: No ad to show from all configured ad networks.}

As far as when to invoke [self.delegate customEventBanner:self didReceiveAd:bannerView_];, it depends on your custom event. If your custom event just returns a static image, you can invoke didReceiveAd: directly in requestBannerAd:parameter:label:request: with that image.

But if you're implementing some ad network that AdMob Mediation doesn't already support, chances are they will have some kind of listener to tell you when they received an ad (in AdMob's case, that would be GADBannerViewDelegate's adViewDidReceiveAd callback). You should listen for that network's received ad callback and in that listener invoke didReceiveAd:.

For your main GADRequest to AdMob that ends up triggering your custom event, you should set a GADBannerViewDelegate on your GADBannerView to listen for the callbacks from your custom event or any other network you may have in your mediation flow. If you get adViewDidReceiveAd:, you know AdMob Mediation found an ad from one of your networks.

OTHER TIPS

I am struggling with the same issue in Xamarin.iOS but now I have resolved it :

[follow this step][for Xamarin.iOS] `I. here I am passing a request for ads mob :

  adView.LoadRequest(request);

II. if adview has been failed on loading ads request.

 adView.ReceiveAdFailed += (object sender, BannerViewErrorEventArgs ea) => {
                                        viewOnScreen = false;
                    Console.WriteLine(ea.Error.Description);
                    adView.LoadRequest(request);
                                    };

III. then we will get mob ads response here.

 adView.AdReceived += (sender, args) =>
                {
                    viewOnScreen = true;
                    if (!viewOnScreen) this.AddSubview(adView);
                };`
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top