AdMob Rewarded Video & Interstitial Ads Shows Only Once

Using test mode, I can get AdMob to show one rewarded video ad (iOS). After that, no more ads are shown.

if admob.isLoaded(“rewardedVideo”) then
admob.show(“rewardedVideo”)
end

All was well a couple of days ago. I’ve checked the console output - the output is as expected, until I request a second rewarded video ad, then the callback does not fire. This is irrespective if I allow tracking permission or not when the ATT popup appears. Not that that should matter with test ads.

The last reporting I get in the console is:
event.provider = admob
event.type = rewardedVideo
event.phase = reward

No more callbacks to the AdMob callback occur after the first (and only!) rewarded video shows! :frowning:

admob.init(AdMobListener, {testMode = true})

Are you experiencing the same?

There’s something screwy going on here with the AdMob plugin. Is it my code, or the plugin?
I really do think it’s the plugin. I’ve been using AdMob rewarded videos for years on and off. I’ve followed the instructions in the documentation and I’ve inspected the console output in detail. If no rewarded test ads were showing than I’d suspect the fault was on my side. Still - I get just the one rewarded video ad and then no more. iOS

Banner ads are working fine. Interstitial ads also show once only and then no more!

I really would appreciate some help, as I’m unable to update the app without AdMob and I know the plugin has been updated recently. Thanks! :slight_smile:

Solar2D version is 3651.
AdMob sdk showing in the console as plugin.admob: 1.2.6 (SDK: afma-sdk-i-v8.5.0)
iPad Mini 14.4.2
Xcode 12.4 Big Sur

I’ve now updated to iOS 14.7.1 and tried Catalina as opposed to Big Sur. No joy.
I’ve also tried with live ads. Got one live ad (TikTok) and no more after that. That’s my account at risk! Yikes!

I followed these instructions, but still no joy.

google.com, pub-3940256099942544, DIRECT, f08c47fec0942fa0

Does this happen on iOS and Android

1 Like

I wish I could say @vlads - but I don’t have Android apps. But I feel joyous that you have posted about it on these forums! :slight_smile:

I don’t use the ATT plugin. Just NSUserTrackingUsageDescription in build.settings. Is that correct? Thanks!

1 Like

I’ve tried with the ATT plugin, still no joy. Ah well, the sun is shining and I’m giving serious consideration to reading The Count of Monte Cristo! :heart_eyes:

I am using the same plugin and don’t have this issue both on iOS and Android. Please find attached my code. Maybe you can find something missing with your implementation.

Just ignore the admobtapjoy plugin calls.

admob.lua.zip (1.1 KB)

1 Like

@agramonte thank you so much for the file.

I don’t pass any optional params to admob.load(). My call is simply

admob.load(“rewardedVideo”, {adUnitId = adMobRewardedID})

Still, I am interested to know that all is well at your end. It’s all a bit weird that I get one ad and no more. After your post, it seems the plugin is sound.

Maybe my environment is not correct. I will update Xcode and whatever else I can. My build.settings might be wrong.

I don’t use plugin.att, but I have tried it without success. Hmmm… I will investigate.

What is your iOS, macOS, Xcode and Solar2D versions please? I’d be interested in the relevant portion of your build.settings.

I can’t seem to figure out how to format code on here…

settings = {
splashScreen =
{
enable = false
},
orientation = {
default = “portrait”,
supported = {“portrait”}
},
iphone = {
xcassets = “Images.xcassets”,
plist = {
GADApplicationIdentifier = “ca-app-pub-etc”,
SKAdNetworkItems = {
{SKAdNetworkIdentifier = “cstr6suwn9.skadnetwork”,},
{SKAdNetworkIdentifier = “4fzdc2evr5.skadnetwork”,},
{SKAdNetworkIdentifier = “2fnua5tdw4.skadnetwork”,},
{SKAdNetworkIdentifier = “ydx93a7ass.skadnetwork”,},
{SKAdNetworkIdentifier = “5a6flpkh64.skadnetwork”,},
{SKAdNetworkIdentifier = “p78axxw29g.skadnetwork”,},
{SKAdNetworkIdentifier = “v72qych5uu.skadnetwork”,},
{SKAdNetworkIdentifier = “c6k4g5qg8m.skadnetwork”,},
{SKAdNetworkIdentifier = “s39g8k73mm.skadnetwork”,},
{SKAdNetworkIdentifier = “3qy4746246.skadnetwork”,},
{SKAdNetworkIdentifier = “3sh42y64q3.skadnetwork”,},
{SKAdNetworkIdentifier = “f38h382jlk.skadnetwork”,},
{SKAdNetworkIdentifier = “hs6bdukanm.skadnetwork”,},
{SKAdNetworkIdentifier = “prcb7njmu6.skadnetwork”,},
{SKAdNetworkIdentifier = “v4nxqhlyqp.skadnetwork”,},
{SKAdNetworkIdentifier = “wzmmz9fp6w.skadnetwork”,},
{SKAdNetworkIdentifier = “yclnxrl5pm.skadnetwork”,},
{SKAdNetworkIdentifier = “t38b2kh725.skadnetwork”,},
{SKAdNetworkIdentifier = “7ug5zh24hu.skadnetwork”,},
{SKAdNetworkIdentifier = “9rd848q2bz.skadnetwork”,},
{SKAdNetworkIdentifier = “n6fk4nfna4.skadnetwork”,},
{SKAdNetworkIdentifier = “kbd757ywx3.skadnetwork”,},
{SKAdNetworkIdentifier = “9t245vhmpl.skadnetwork”,},
{SKAdNetworkIdentifier = “4468km3ulz.skadnetwork”,},
{SKAdNetworkIdentifier = “2u9pt9hc89.skadnetwork”,},
{SKAdNetworkIdentifier = “8s468mfl3y.skadnetwork”,},
{SKAdNetworkIdentifier = “av6w8kgt66.skadnetwork”,},
{SKAdNetworkIdentifier = “klf5c3l5u5.skadnetwork”,},
{SKAdNetworkIdentifier = “ppxm28t8ap.skadnetwork”,},
{SKAdNetworkIdentifier = “424m5254lk.skadnetwork”,},
{SKAdNetworkIdentifier = “uw77j35x4d.skadnetwork”,},
{SKAdNetworkIdentifier = “578prtvx9j.skadnetwork”,},
{SKAdNetworkIdentifier = “4dzt52r2t5.skadnetwork”,},
{SKAdNetworkIdentifier = “e5fvkxwrpn.skadnetwork”,},
{SKAdNetworkIdentifier = “8c4e2ghe7u.skadnetwork”,},
{SKAdNetworkIdentifier = “zq492l623r.skadnetwork”,},
{SKAdNetworkIdentifier = “3qcr597p9d.skadnetwork”,},
},
ITSAppUsesNonExemptEncryption = false,
UILaunchStoryboardName = “LaunchScreen”,
NSAppTransportSecurity = {NSAllowsArbitraryLoads = true},
UIStatusBarHidden = true,
UIPrerenderedIcon = true, – Set to false for “shine” overlay.
CFBundleDisplayName = “XXX”,
NSUserTrackingUsageDescription = “Your data will be used to deliver personalized ads to you.”,
},
},
plugins = {
[“plugin.reviewPopUp”] =
{
publisherId = “tech.scotth”,
},
[“CoronaProvider.native.popup.activity”] = {
publisherId = “com.coronalabs”,
},
[“CoronaProvider.native.popup.social”] = {
publisherId = “com.coronalabs”,
},
[“plugin.admob”] = {
publisherId = “com.coronalabs”,
},
–[[
[‘plugin.att’] = {
publisherId = ‘com.solar2d’
},
[“plugin.applovin.paid”] =
{
publisherId = “com.coronalabs”,
},
[“plugin.unityads”] =
{
publisherId = “com.coronalabs”
},
–]]
},
}

You’ve been generous enough as it is. I will need to figure this out.

For formating here just hit spacebar 3 or 4 times for a paragraph and the entire paragraph turns into block.

Info your requested:

Corona version: 3645 (I don't upgrade unless I have to).
Build Type: 14.5 Non-Metal (None of my games run with Metal. They all throw a texture not recognized error).
XCode: 12.5.1
MacOS: 11.4 

Relevant plugin section:

plugins =
    {

    ["plugin_admobtapjoy"] = {
        publisherId = "com.cabagomez"
    }, 
    ["plugin_admobadcolony"] = {
        publisherId = "com.cabagomez"
    },
    ["plugin_admobapplovin"] = {
        publisherId = "com.cabagomez"
    },
    ["plugin_admobfacebook"] = {
        publisherId = "com.cabagomez"
    },
    ["plugin_admobchartboost"] = {
        publisherId = "com.cabagomez"
    },
    ["plugin_admobunity"] = {
        publisherId = "com.cabagomez",
        supportedPlatforms = { android = true, ["android-kindle"]=false, iphone=true } 
    }
},

Relevant iPhone section:

iphone =
{
    xcassets = "Images.xcassets",
	plist =
	{
        MinimumOSVersion = "9.0",
        AppLovinSdkKey = "qg4rORL8m_xxxxxxxx",
        UIBackgroundModes = {"remote-notification"},
        GADApplicationIdentifier = "ca-app-pub-xxxxxxxx",
        UIStatusBarHidden = true,
        UILaunchStoryboardName = "LaunchScreen",
        NSPhotoLibraryAddUsageDescription = "This app would like to add the photo library.",
        NSAppTransportSecurity = { 
            NSAllowsArbitraryLoads=true,
            NSAllowsArbitraryLoadsForMedia = true,
            NSAllowsArbitraryLoadsInWebContent = true 
            
        },
        SKAdNetworkItems = {
            { SKAdNetworkIdentifier = "su67r6k2v3.skadnetwork" }
            ...
 
        },
        NSLocationWhenInUseUsageDescription = "This app would like to use location service to show local ads.",
        NSUserTrackingUsageDescription = "This allows you to see more relevant advertising"
	}
},

Ok. I created a pull request and once @vlads is around he can merge it.

Admob is not autoload. So you need to reload it manually. I usually do it on: “phase=closed”.

 if event.phase == "closed" then
        admob.load( event.type, { 
             adUnitId = adProvider.options.keys[event.type],  -- this is just a table with the adunit for the type.
             hasUserConsent = adProvider.options.consent 
        } 
)
end

But as a few of you have mentioned that you don’t get that event. I have fixed that issue and I have created a merge for @vlads.

One other thing I noticed with the sample that was sent to me. The init does not require the appId and should be like this:

admob.init( adListener, { testMode=true } )

Other then that happy coding.

Thanks @agramonte most sincerely.

Well, this one time showing of the interstitial or rewarded video is weird. I’ve scrutinized the console log. No doubt about it, the admob callback does not fire when a rewarded video or interstitial ad is closed.

local function AdMobListener(event)

print("********************************************")
print("AdMobListener(event)")
print("event.response = " .. tostring(event.response))
print("event.provider = " .. tostring(event.provider))
print("event.isError = " .. tostring(event.isError))
print("event.type = " .. tostring(event.type))
print("event.name = " .. tostring(event.name))
print("event.phase = " .. tostring(event.phase))
print("event.data = " .. tostring(event.data))
print("********************************************")

if event.phase == "init" then
    print("********************************")
    print("Loading AdMob Rewarded")
    print("Loading AdMob Interstitial")
    print("Loading AdMob Banner")
    print("********************************")
    admob.load("rewardedVideo", {adUnitId = adMobRewardedID})
    admob.load("interstitial", {adUnitId = adMobInterstitialID})
    admob.load("banner", {adUnitId = adMobBannerID})
end
    
if event.type == "interstitial" then
    if event.phase == "closed" or event.phase == "clicked" or event.phase == "failed" then
        adShowing = false
        
        if event.phase ~= "failed" then
            print("********************************")
            print("Loading AdMob interstitial after ad " .. tostring(event.phase))
            print("********************************")
            admob.load("interstitial", {adUnitId = adMobInterstitialID})
        end
        
        if not title and not storeWindow and not hideAds then
            ShowBanner()
        end
    end
end

if event.type == "rewardedVideo" then
    if event.phase == "closed" or event.phase == "clicked" or event.phase == "failed" then
        showRewarded = true
        adShowing = false
        
        if event.phase ~= "failed" then
            print("********************************")
            print("Loading AdMob rewarded after ad " .. tostring(event.phase))
            print("********************************")
            admob.load("rewardedVideo", {adUnitId = adMobRewardedID})
        end
        
        if not title and not storeWindow and not hideAds then
            ShowBanner()
        end
    end
end

if event.type == "rewardedVideo" and event.phase == "reward" then
    print("********************************")
    print("AdMob rewarded video ad has been viewed to its completion")
    print("********************************")
    print("event.data = " .. tostring(event.data))
    showRewarded = true
    adShowing = false
end

end

admob.init(AdMobListener, {testMode = true})

I can get round the problem with:

   timer.performWithDelay(4000, function() admob.load("rewardedVideo", {adUnitId = adMobRewardedID}) showRewarded = true end, 1) 

But it feels like a hack!

I agree with @agramonte- if you’re getting an ad the first time but not later, it’s because you’re not loading a new ad after you play the first one.

The event.phase I use for AdMob is “displayed” not “closed”. In your listener, you should be able to do something simple like:

if ( event.phase == "displayed" ) then
  print( "Ad was displayed, trying to load a new one..." )
  if ( admob.isLoaded( "interstitial" ) == false ) then
   print( "Reloading an interstitial ad!" )
   admob.load( "interstitial", { adUnitId = adMobInterstitialID, hasUserConsent = true } )
 end
 if ( admob.isLoaded( "rewardedVideo" ) == false ) then
   print( "Reloading a reward ad!" )
   admob.load( "rewardedVideo", { adUnitId = adMobRewardedID, hasUserConsent = true } )
 end
end

Unfortunately, my own code is too tied in to how my waterfall works to be helpful, so I just wrote this off the cuff. You’ll want to double check it for dumb syntax errors, use your own variable system for hasUserConsent, etc. and once you’ve got it working write it into your system in a way that makes sense, but, in principle, this should reload your ads after you display them.

Also, I don’t know what the timing is for AdMob to “unloading” and ad, so if the above doesn’t work, try pulling the if ( admob.isLoaded... conditional and just try loading both ad types every time event.phase == "displayed" or tie it to event.type. Lots of different approaches.

The displayed event seems a good place to handle loading. Thanks @colinmorgan

My AdMob callback does not get called at all when an interstitial or rewarded ad is closed or clicked. My code is the same as for previous app updates, and the AdMob callback has always fired on ad closure or click. Until now. Very odd and most annoying!

I always load a new ad after playing the first one. It’s just that the loading no longer happens now that the callback isn’t firing. And yet the callback fires for:

   if event.type == "rewardedVideo" and event.phase == "reward" then

Something has happened to stop my callback from firing as it used to. Fortunately, there’s plenty of alternative solutions! :slight_smile:

This should be fixed shortly. Scott is going to merge my pull request. Once that happens all the events should fire as before.

1 Like

Pushed out new binaries, in my testing seems to have fixed issue

1 Like

YAY! Terrific work guys. I love the smell of a good callback in the morning!

Console log:

[Device] ********************************************
[Device] AdMobListener(event)
[Device] event.response = nil
[Device] event.provider = admob
[Device] event.isError = false
[Device] event.type = rewardedVideo
[Device] event.name = adsRequest
[Device] event.phase = closed
[Device] event.data = {"adUnitId":"ca-app-pub-XXX"}
[Device] ********************************************
[Device] ********************************
[Device] Loading AdMob rewarded after ad closed
[Device] ********************************
[Device] plugin.admob: Test mode active for device '(

event.phase = closed :slight_smile: