-- Set up ad listener. local function adListener( event ) -- event table includes: -- event.provider -- event.isError (e.g. true/false ) 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:setTextColor( 255, 0, 0 ) statusText.text = "Error Loading Ad" statusText.x = display.contentWidth \* 0.5 showAd( "banner" ) else statusText:setTextColor( 0, 255, 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. if appID then ads.init( provider, appID, adListener ) end
The code in the sample has the showAd( “banner” ) inside the “if event.isError then” conditional. I’m assuming this should be in the else instead?