Here is how i finally managed to show both ads (banner and intertitial):
I have initialized the ads.show function with the following number: “ca-app-pub-4703317686453462/X” (literally), that is: ads.init( “admob”, “ca-app-pub-4703317686453462/X”,adListener )
and I have used my different codes for banner an interstitial as follows:
[lua]
local ads = require "ads"
– Admob configuration
local BannerAppID = “ca-app-pub-4703317686453462/3275893837” --Banner
local InterstitialAppID = “ca-app-pub-4703317686453462/4752627031” --Interstitial
print ("-- Starting …")
local splashScreen=display.newImage (“imagen.jpg”)
splashScreen.x=display.contentWidth/2
splashScreen.y=display.contentHeight/2
– Set up ad listener.
local function adListener( event )
print ("-- adListener:", event.type)
end
– Initialize the ‘ads’ library with the provider you wish to use.
print ("-- Showing banner")
ads.init( “admob”, “ca-app-pub-4703317686453462/X”,adListener )
ads.show( “banner”, { x=display.screenOriginX, y=display.contentHeight-display.screenOriginY-60,appID=“ca-app-pub-4703317686453462/3275893837” } )
local function showInterstitial()
print("-- showInterstitial function")
ads.show( “interstitial”, { appID=“ca-app-pub-4703317686453462/4752627031” } )
end
timer.performWithDelay(1000, showInterstitial, 1)
[/lua]
From my personal point of view there is a mistake in the init function of the admob plugin.
I’ve also noticed the interstitial ad is shown after the banner ad is loaded and usually takes a long time the first time, so I suspect that that can be improved.