Enhance library interstitial ad error: Request Error: No ad to show

I’ve just started trying to integrate ads with Enhance, and everything seems to be set up. However, when I try to display my interstitial ad, I’m getting this response:

[enhance.sdk.admob_mediation@afma-sdk-i-v7.27.0 InterstitialAd] didFailToReceiveAdWithError Error Domain=com.google.ads Code=1 "Request Error: No ad to show."

From looking around it seems like this means there are no ads to serve…which seems odd since if I use other apps I’m always presented with ads as usual. Is there anything to check with the configuration that might be causing this issue? Or is there a way to set up a test ad that always succeeds for dev purposes?

@FGL_Luke @FGL_Rozek any thoughts?

You can use testads from admob:
https://developers.google.com/admob/android/test-ads
They worked for me.
I did read that you have to use testads while developing your APP. I think its not allowed to test your APP with real ADS all the time.

“It’s important to enable test ads during development so that you can click on them without charging Google advertisers. If you click on too many ads without being in test mode, you risk your account being flagged for invalid activity.”

1 Like

Thanks for the tip. I tried again with real ads and they appeared to work correctly today. I think it might just take some time for the new ad units to propagate through their system. See: https://stackoverflow.com/a/43013919/7112353

1 Like

I had another question regarding Enhance: is there a way to execute code after completing an interstitial ad, like a callback function? The only documentation I’ve seen is this:

1) Check whether any ad is available:

    is_ready = enhance.isInterstitialReady()

2) Show the ad:
    
    enhance.showInterstitialAd()

Note:
Interstitial ads will automatically interrupt the flow of your application until the user completes interaction with the ad.

In that note, it seems like the ad should block the main thread so the game would effectively pause until the ad is completed…but that’s not the case. The game keeps running in the background while the ad is displayed. Is there any way for me to check when the ad is closed (or clicked and the user returns) so I can properly navigate the user?

I’ve also asked this on the Enhance forums, but I figured this might be defold-specific so I figured I’d ask here as well!

Maybe you can use the window callback for WINDOW_EVENT_FOCUS_LOST and _GAINED? Not sure, but it could be that those callbacks are invoked when the ad is shown. But if you say the game keeps running in the background it’s unlikely though…

Hi. Sorry to hear you are running into issues.
I have reached out to engineering and someone will be looking into this.

2 Likes

Is there any update to this? I’m going to be using the interstitials and expect the enhance.showInterstitialAd() to block the main thread. Did the enhance engineering get this resolved, or can someone verify the workaround that britzl mentioned worked?

Thanks!

I didn’t end up testing britzl’s solution, so not sure if that would work or not. I ended up going with another extension (https://www.defold.com/community/projects/93085/) but still have the same issue stated. So it’s not ideal, but I present a ‘continue’ screen after the ad is shown and the user has to click to advance.

2 Likes

Several people reported the issue, working on fixing it in the admob extension.

3 Likes

I tested this myself and it appears that the main thread does pause when the interstital is displayed, however: The main thread runs after the show call until the ad is displayed. I’m going to implement a timer pause after calling enhance.showInterstitialAd() before continuing in my program to see if that resolves it. While not ideal, that would work for me.

1 Like

Engineering is working on a fix. Sorry for the delays.

2 Likes

Fixed the bug, now reloading interstitials on Android should not crash the app. Also added a lot of targeting options like gender, birthday, children tag, etc.

2 Likes