AdMob using both banner and interstitial ads - HELP!

I did this. Multiple times.

My code.

-- Your Android application ID local bannerAppID = "ca-app-pub-8347067101481503/2335507715" local interstitialAppID = "ca-app-pub-8347067101481503/5236550917" if system.getInfo("platformName") == "iPhone OS" then -- Your iOS application IDs intersititalAppID = "ca-app-pub-8347067101481503/3759817713" bannerAppID = "ca-app-pub-8347067101481503/4080572917" end 

I just ran and tested this code on my iPhone.  You may have issues with your AdMob portal where you get your AppId’s from.  Why are you submitting apps before you have this working?

Are you by any chance testing on a Rooted or Jailbroken device?  Are you getting any errors in your device’s console log?  I’ve asked for this several times and you have never answered this question.  There will be reasons why it’s not working an it will be printed in your device log.

Rob

 My account doesnt even say Im a basic member. -_-

I’ve tested it on my iPhone but that was with no ads. No its not jailbroken and I submit it cause my fan base were begging me too.

How can I make a test app and how to I view the device log???

You don’t need to be a Basic account to use AdMob ads.  You need it to do In App Purchases.  The forums don’t always catch up with your account setting.

How do you view your device log?   Please read this tutorial:  http://coronalabs.com/blog/2013/07/09/tutorial-basic-debugging/

How to make a test app?  It’s not any different than any other app.  You need a main.lua with that code in it.  A build.settings that includes your plugin and a config.lua.

Rob

Wow I think he’s helped you plenty as it is. That kind of attitude no ones going to offer you any help.

@LsVtechTurbo95, the Corona community forums are here to help you on a best effort method.  Corona Labs cannot write your program for you.  If you wish to hire a Corona Developer you can request a quote in one of our sub-forums dedicated to hiring Corona Developers.  See:  http://forums.coronalabs.com/forum/586-corona-jobs/

There is an expectation that you will try to also help yourself.  All advice that’s been given to you on this topic has been sound and has been given to you by multiple people.  I don’t know why you and your programmer are having difficulties implementing this.  You have to take some responsibility yourself.  No one on this forum has access to your AdMob account (nor should they).  By refusing to provide information from your console log (and having been shown twice to the tutorial that teaches you how), there isn’t much anyone on this forum can do for you. 

I even provided you a 100% complete working AdMob sample main.lua.   It’s job is to show a screen and show an ad.  It’'s up to you to adapt this.

We have very specific forum rules and expected behavior from community members.  Please make sure you read and understand these rules before you post to the forums:  http://coronalabs.com/blog/2013/04/02/corona-forum-rules-and-guidelines/

Rob

Hey lessmsios, did you figure it out? I have the same problem. I read that when you do “ads.init” you can put whichever appID with no problem, just as long as you ask for the correct ads in the “ads.show” part. But it isn’t working for me.

Nope. The tutorial http://coronalabs.com/blog/2014/07/15/tutorial-implementing-admob-v2/ mentions using both but there is no working code example that proves it does. :frowning:

Ok - finally discovered the answer to my initial question/problem after returning to this app.

I was trying to put up an interstitial ad just before going back to a different scene which displayed a banner ad. In doing so the call to show the banner obviously kept the interstitial from displaying. This was checked by commenting out the banner ad.

User (my) error, but thanks for the feedback!

David

Found the problem,…  {appId = “xxxx”} (small “d”), not  {appID = “xxxx”} (capital “D”)  :slight_smile:

Heres my code for showing different type of admob ads. It works for me, I don’t have them run in the same scene though, so like banner on the start menu for example and pop up occurs in the game after game over for example. But:

local AdMob = require("ads") local adMobId = "ca-app-pub-my#" local adMobIdInter = "ca-app-pub-diff#" local adMobListener = function(event) print("ADMOB AD - Event: " .. event.response) end AdMob.init( "admob", adMobId, adMobListener ) --Than where I need to show it: AdMob.show( "banner", {x=0, y=position}) AdMob.show( "interstitial", {appId=adMobIdInter} )

Can someone please help me fix my code to were my banner ads show up

My Build.setting code; 

settings = { plugins = { ["CoronaProvider.ads.admob"] = { publisherId = "com.coronalabs", supportedPlatforms = { iphone=true } }, ["plugin.google.play.services"] = { publisherId = "com.coronalabs", supportedPlatforms = { android=true }, }, ["CoronaProvider.gameNetwork.google"] = { --required! publisherId = "com.coronalabs", supportedPlatforms = { android=true } }, ["facebook"] = { publisherId = "com.coronalabs", supportedPlatforms = { iphone=true}, }, }, orientation = { default = "portrait", supported = { "portrait", } }, android = { usesPermissions = { "android.permission.INTERNET", "android.permission.ACCESS\_NETWORK\_STATE", }, }, iphone = { plist = { UIAppFonts = { "QuentinCaps.ttf", }, UIViewControllerBasedStatusBarAppearance = false, UIStatusBarHidden = true, CFBundleIconFile = "Icon.png", CFBundleIconFiles = { "Icon.png", "Icon@2x.png", "Icon-60.png", "Icon-60@2x.png", "Icon-72.png", "Icon-72@2x.png", "Icon-76.png", "Icon-76@2x.png", "Icon-Small.png", "Icon-Small@2x.png", "Icon-Small-50.png", "Icon-Small-50@2x.png", }, UIApplicationExitsOnSuspend = false, -- must be false for single sign-on to work FacebookAppID = "329435700566704", -- replace XXXXXXXXX with your facebook appId CFBundleURLTypes = { { CFBundleURLSchemes = { "fb329435700566704", -- replace XXXXXXXXX with your facebook appId, make sure that you leave fb in front of "app910588198" } } } } }, }

my main.lua 

local composer = require( "composer" ) display.setStatusBar(display.HiddenStatusBar) \_G.prefLib = require "prefLib" \_G.adsLib = require "adsLib" \_G.networksLib = require "networksLib"; local activeNetworksProviders = { ["Android"] = {"google", "CgkIhNyInMgZEAIQAQ"}, ["iPhone OS"] = {"gamecenter", "CgkIhNyInMgZEAIQAQ"} --replace "gamecenter" with "none" if you don't use any leaderboard! }; --networksLib.init(activeNetworksProviders); -- For in game Ad's use this table and call local activeAdsProviders = { ["Android"] = {"chartboost","admob","revmob"}, ["iPhone OS"] = {"chartboost","admob","revmob"}, }; adsLib.init(activeAdsProviders); ---===================sound related tasks \_G.musicChannel = 1; audio.reserveChannels(1); --and let's immediately set the volume to the values saved throughout plays local m = prefLib.getSaveValue("musicVolume") or .3 prefLib.setSaveValue("musicVolume",m,true) audio.setVolume(m, {channel = \_G.musicChannel}); for i = 2, audio.totalChannels do local s = \_G.prefLib.getSaveValue("sfxVolume") or .5 prefLib.setSaveValue("sfxVolume",s,true) audio.setVolume(s, {channel = i}); end --also, we're going to use this sound everywhere, so I'll load it here as a global variable once \_G.splashSFX = audio.loadStream("sounds/splash.mp3"); \_G.clickSFX = audio.loadSound("sounds/click.wav"); \_G.fireSFX = audio.loadSound("sounds/spring.wav"); \_G.jumpSFX = audio.loadSound("sounds/jump.wav"); \_G.rocketSFX = audio.loadSound("sounds/rocket.wav"); \_G.fallSFX = audio.loadSound("sounds/fall.wav"); \_G.coinSFX = audio.loadSound("sounds/coin.mp3"); \_G.gunShot = audio.loadSound("sounds/gunshot.mp3"); audio.play(splashSFX, {channel = audio.findFreeChannel()}); -- Later... local img = display.newImageRect("assets/Splash Screen1.jpg",640,1136) img.x = display.contentWidth/2 img.y = display.contentHeight/2 local function move() display.remove(img);img = nil composer.gotoScene( "homescene","fade",1500 ) end timer.performWithDelay(4000,move,1)

Please help me fix this ASAP. Thanks

@LsVtechTurbo95, please do not ask your question more than once a day.  This is called “Bumping” and we only permit bumping once per day.  It takes time for the community to come on and read your post.  You are also only allowed to post the same question in one forum thread. 

We want you to get help, but if you keep posting this over and over, we will be forced to remove your excessive posts. 

Thank you!

Here is the code I used for the the tutorial to test it.

-------------------------------------------------------------------------------- -- Sample code is MIT licensed, see http://www.coronalabs.com/links/code/license -- Copyright (C) 2013 Corona Labs Inc. All Rights Reserved. -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -- Setup -------------------------------------------------------------------------------- -- Hide the status bar display.setStatusBar( display.HiddenStatusBar ) -- Load Corona 'ads' library local ads = require( "ads" ) -------------------------------------------------------------------------------- -- Setup ad provider -------------------------------------------------------------------------------- -- The name of the ad provider. local provider = "admob" -- Your Android application ID local bannerAppID = "ca-app-pub-\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*/\*\*\*\*\*\*\*\*\*\*" local interstitialAppID = "ca-app-pub-\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*/\*\*\*\*\*\*\*\*\*" if system.getInfo("platformName") == "iPhone OS" then     -- Your iOS application IDs     intersititalAppID = "ca-app-pub-\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*/\*\*\*\*\*\*\*\*\*"     bannerAppID = "ca-app-pub-\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*/\*\*\*\*\*\*\*\*\*" end function print\_r ( t )     local print\_r\_cache={}     local function sub\_print\_r(t,indent)         if (print\_r\_cache[tostring(t)]) then             print(indent.."\*"..tostring(t))         else             print\_r\_cache[tostring(t)]=true             if (type(t)=="table") then                 for pos,val in pairs(t) do                     if (type(val)=="table") then                         print(indent.."["..pos.."] =\> "..tostring(t).." {")                         sub\_print\_r(val,indent..string.rep(" ",string.len(pos)+8))                         print(indent..string.rep(" ",string.len(pos)+6).."}")                     elseif (type(val)=="string") then                         print(indent.."["..pos..'] =\> "'..val..'"')                     else                         print(indent.."["..pos.."] =\> "..tostring(val))                     end                 end             else                 print(indent..tostring(t))             end         end     end     if (type(t)=="table") then         print(tostring(t).." {")         sub\_print\_r(t,"  ")         print("}")     else         sub\_print\_r(t,"  ")     end     print() end -- create a background for the app local background = display.newRect( 0, 0, display.contentWidth, display.contentHeight ) background.anchorX = 0 background.anchorY = 0 background:setFillColor( 0, 0, 0.5 ) -- Create a text object to display ad status local statusText = display.newText( "", 0, 0, native.systemFontBold, 22 ) statusText:setFillColor( 255 ) statusText.x, statusText.y = display.contentWidth \* 0.5, 160 -- Set up ad listener. local function adListener( event )     -- event table includes:     --         event.provider     --        event.isError (e.g. true/false )     print\_r(event)     local msg = event.response     -- just a quick debug message to check what response we got from the library     print("Message received from the ads library: ", msg)     if event.isError then         statusText:setFillColor( 1, 0, 0 )         statusText.text = "Error Loading Ad"         statusText.x = display.contentWidth \* 0.5         showAd( "banner", appID )     else         statusText:setFillColor( 0, 1, 0 )         statusText.text = "Successfully Loaded Ad"         statusText.x = display.contentWidth \* 0.5     end end -- Initialize the 'ads' library with the provider you wish to use. local appID = bannerAppID if not bannerAppID then     appID = interstitalAppID end ads.init( provider, appID, adListener ) local function showBannerAd()     ads.show("banner", { appId = bannerAppID, testMode = true }) end local function preloadInterstitialAd()     ads.load("interstital", { appId = intersititalAppID, testMode = true }) end local function showInterstitialAd()     ads.show() end local function showInterstitial()     print("checking to see if the interstital is ready")     if ads.isLoaded("interstitial") then         print("showing the interstitial")         ads.show("interstitial", { appId = interstitialAppID, testMode = true })         timer.cancel(showAdTimer)         showAdTimer = nil     end end local function changeAds()     print("changing ad types")     ads.hide()     --     -- use the ads.show() to test just showing an interstitial     -- use the ads.load() to test using ad.load()     --     --ads.show("interstitial", { appId = interstitialAppID, testMode = true } )     ads.load("interstitial", { appId = interstitialAppID, testMode = true } )     showAdTimer = timer.performWithDelay(100, showInterstitial,0) end -------------------------------------------------------------------------------- -- UI -------------------------------------------------------------------------------- -- initial variables local sysModel = system.getInfo("model") local sysEnv = system.getInfo("environment") -- Shows a specific type of ad showAd = function( adType, vendorAppID )     local adX, adY = 0, display.contentHeight - 30     statusText.text = "Showing " .. adType     ads.show( adType, { x=adX, y=adY, appId=vendorAppID, testMode = true } ) end -- if on simulator, let user know they must build for device if sysEnv == "simulator" then     local font, size = native.systemFontBold, 22     local warningText = display.newRetinaText( "Please build for device or Xcode simulator to test this sample.", 0, 0, 290, 300, font, size )     warningText:setTextColor( 1 )     warningText.x, warningText.y = display.contentWidth \* 0.5, display.contentHeight \* 0.5 else     -- start with banner ad     showAd( "banner", appID )     timer.performWithDelay(15000, changeAds, 1) end local function onSystemEvent( event )     print( "System event name and type: " .. event.name, event.type )     if event.type == "applicationResume" and isInterstitialShowing then         print("The ad closed")         showBannerAd()     end end Runtime:addEventListener( "system", onSystemEvent )

 Does my code look right and where do I add this to and is the to replace something or to add with something?

-------------------------------------------------------------------------------- -- Sample code is MIT licensed, see http://www.coronalabs.com/links/code/license -- Copyright (C) 2013 Corona Labs Inc. All Rights Reserved. -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -- Setup -------------------------------------------------------------------------------- -- Hide the status bar display.setStatusBar( display.HiddenStatusBar ) -- Load Corona 'ads' library local ads = require( "ads" ) -------------------------------------------------------------------------------- -- Setup ad provider -------------------------------------------------------------------------------- -- The name of the ad provider. local provider = "admob" -- Your Android application ID local bannerAppID = "ca-app-pub-8347067101481503/5236550917" local interstitialAppID = "ca-app-pub-8347067101481503/2335507715" if system.getInfo("platformName") == "iPhone OS" then -- Your iOS application IDs intersititalAppID = "ca-app-pub-8347067101481503/4080572917" bannerAppID = "ca-app-pub-8347067101481503/3759817713" end function print\_r ( t ) local print\_r\_cache={} local function sub\_print\_r(t,indent) if (print\_r\_cache[tostring(t)]) then print(indent.."\*"..tostring(t)) else print\_r\_cache[tostring(t)]=true if (type(t)=="table") then for pos,val in pairs(t) do if (type(val)=="table") then print(indent.."["..pos.."] =\> "..tostring(t).." {") sub\_print\_r(val,indent..string.rep(" ",string.len(pos)+8)) print(indent..string.rep(" ",string.len(pos)+6).."}") elseif (type(val)=="string") then print(indent.."["..pos..'] =\> "'..val..'"') else print(indent.."["..pos.."] =\> "..tostring(val)) end end else print(indent..tostring(t)) end end end if (type(t)=="table") then print(tostring(t).." {") sub\_print\_r(t," ") print("}") else sub\_print\_r(t," ") end print() end -- create a background for the app local background = display.newRect( 0, 0, display.contentWidth, display.contentHeight ) background.anchorX = 0 background.anchorY = 0 background:setFillColor( 0, 0, 0.5 ) -- Create a text object to display ad status local statusText = display.newText( "", 0, 0, native.systemFontBold, 22 ) statusText:setFillColor( 255 ) statusText.x, statusText.y = display.contentWidth \* 0.5, 160 -- Set up ad listener. local function adListener( event ) -- event table includes: -- event.provider -- event.isError (e.g. true/false ) print\_r(event) local msg = event.response -- just a quick debug message to check what response we got from the library print("Message received from the ads library: ", msg) if event.isError then statusText:setFillColor( 1, 0, 0 ) statusText.text = "Error Loading Ad" statusText.x = display.contentWidth \* 0.5 showAd( "banner", appID ) else statusText:setFillColor( 0, 1, 0 ) statusText.text = "Successfully Loaded Ad" statusText.x = display.contentWidth \* 0.5 end end -- Initialize the 'ads' library with the provider you wish to use. local appID = bannerAppID if not bannerAppID then appID = interstitalAppID end ads.init( provider, appID, adListener ) local function showBannerAd() ads.show("banner", { appId = bannerAppID, testMode = true }) end local function preloadInterstitialAd() ads.load("interstital", { appId = intersititalAppID, testMode = true }) end local function showInterstitialAd() ads.show() end local function showInterstitial() print("checking to see if the interstital is ready") if ads.isLoaded("interstitial") then print("showing the interstitial") ads.show("interstitial", { appId = interstitialAppID, testMode = true }) timer.cancel(showAdTimer) showAdTimer = nil end end local function changeAds() print("changing ad types") ads.hide() -- -- use the ads.show() to test just showing an interstitial -- use the ads.load() to test using ad.load() -- --ads.show("interstitial", { appId = interstitialAppID, testMode = true } ) ads.load("interstitial", { appId = interstitialAppID, testMode = true } ) showAdTimer = timer.performWithDelay(100, showInterstitial,0) end -------------------------------------------------------------------------------- -- UI -------------------------------------------------------------------------------- -- initial variables local sysModel = system.getInfo("model") local sysEnv = system.getInfo("environment") -- Shows a specific type of ad showAd = function( adType, vendorAppID ) local adX, adY = 0, display.contentHeight - 30 statusText.text = "Showing " .. adType ads.show( adType, { x=adX, y=adY, appId=vendorAppID, testMode = true } ) end -- if on simulator, let user know they must build for device if sysEnv == "simulator" then local font, size = native.systemFontBold, 22 local warningText = display.newRetinaText( "Please build for device or Xcode simulator to test this sample.", 0, 0, 290, 300, font, size ) warningText:setTextColor( 1 ) warningText.x, warningText.y = display.contentWidth \* 0.5, display.contentHeight \* 0.5 else -- start with banner ad showAd( "banner", appID ) timer.performWithDelay(15000, changeAds, 1) end local function onSystemEvent( event ) print( "System event name and type: " .. event.name, event.type ) if event.type == "applicationResume" and isInterstitialShowing then print("The ad closed") showBannerAd() end end Runtime:addEventListener( "system", onSystemEvent )

You should be able to take the code I have, put it into a main.lua.  Change your AppID’s as needed from your AdMob portal.   And as long as you have the plugin in your build.settings it should work.

This was designed to be a stand alone test app.  It’s based off of the AdMob sample app on the Corona SDK Github repository.

Rob

How do I can “Change your AppID’s as needed from your AdMob portal” ?

Still nothing. I dont know what going on. I’m starting to feel like I wasted money on my basic account when i cant even place ads on my app. Which means I willn’t make anything from it whats so ever and I already have 700+ users in 2 days since the app has been placed on android.  I still in “waiting for review” for iOS. I submit the app there tuesday. I NEED HELP WITH THIS ASAP.