Issue displaying an interstitial with Corona Ads

Hi,

I’ve been trying Corona Ads and it works well when I try to display a banner.

However, when I use the exact same code for an interstitial nothing shows. I do get a  event.phase == “init” which according to the doc an ad was found. I’ve tried to look for a  event.phase == “failed” but it never happens.

I used the following code

[lua]

– Corona Ads listener function

local function adListener( event )

   – Successful initialization of Corona Ads

   if ( event.phase == “init” ) then

       – Show an ad

       --coronaAds.show( bannerPlacement, false )

       coronaAds.show( interstitialPlacement, true )

       local myTextObject = display.newText( “init”, 400, 400, “Arial”, 75 )

       --timer.performWithDelay( 2000,  coronaAds.hide(),1)

        if ( event.phase == “failed” ) then

local myTextObject = display.newText( “failed”, 400, 500, “Arial”, 75 )

    end

    if ( event.phase == “request” ) then

local myTextObject = display.newText( “request”, 400, 600, “Arial”, 75 )

    end

    if ( event.phase == “found” ) then

local myTextObject = display.newText( “found”, 400, 700, “Arial”, 75 )

    end

   end

    if ( event.phase == “failed” ) then

local myTextObject = display.newText( “failed2”, 400, 800, “Arial”, 75 )

   end

   if ( event.phase == “request” ) then

local myTextObject = display.newText( “request2”, 400, 900, “Arial”, 75 )

    end

    if ( event.phase == “found” ) then

local myTextObject = display.newText( “found2”, 400, 1000, “Arial”, 75 )

    end

end

– Initialize Corona Ads (substitute your own API key when generated)

coronaAds.init( “830e4847-14ce-4df4-8f03-97ce210ebbca”, adListener )[/lua]

It displays ‘init’ and ‘request2’

Not really sure about how to check for the various statuses, documentation pretty much only uses ‘init’.

Thanks

endy

The way you are trying to display results of ad requests is limiting what you can see. There is a whole table of data passed to the listener function including if it’s an error, what the server response was and so on.

A better way to see what’s going on is to simply put:

print( json.prettify( event ) ) 

at the top of your listener function. You of course will have to require the json module with a:

local json = require( "json" )

at the top of the code. Now you will have to be viewing your device’s console log. If you’re using Corona SDK 2830 or later, there will be a console window that opens with the simulator. When you choose to build and install and run on the device, the console log will switch over and start showing your tethered device’s log. Your print message should show up in the console for you to read.

If you’re not using the simulator, then  you will either have to use “adb logcat” or “monitor” for Android devices or Xcode’s Devices screen for iOS. See: http://docs.coronalabs.com/guide/basics/debugging/index.html

Look at the messages and see if you can solve the problem. If not, please post the console long here.

Rob

Hmmm.

I don’t see anything on my Android phone(Galaxy S3?)

I play a sound when I call the ad listener function, so I know it’s being called.

But the screen is black.

I don’t really have any idea how to go about debugging on my phone instead of the simulator :slight_smile:

– Corona Ads listener function

local function adListener( event )

         – Successful initialization of Corona Ads

         if ( event.phase == “init” ) then

             – Show an ad

             audio.play(sndCya)

             --coronaAds.show( bannerPlacement, false )

             coronaAds.show( interstitialPlacement, true )

         end

end

Please read our debugging guide:

http://docs.coronalabs.com/guide/basics/debugging/index.html

If you wish to respond to @gmplayer, please do so on this thread:  https://forums.coronalabs.com/topic/64979-corona-ads-testing/

I’m not going to lock this once in case anyone wants to answer the OP or if the OP comes back with other questions.

Rob

The way you are trying to display results of ad requests is limiting what you can see. There is a whole table of data passed to the listener function including if it’s an error, what the server response was and so on.

A better way to see what’s going on is to simply put:

print( json.prettify( event ) ) 

at the top of your listener function. You of course will have to require the json module with a:

local json = require( "json" )

at the top of the code. Now you will have to be viewing your device’s console log. If you’re using Corona SDK 2830 or later, there will be a console window that opens with the simulator. When you choose to build and install and run on the device, the console log will switch over and start showing your tethered device’s log. Your print message should show up in the console for you to read.

If you’re not using the simulator, then  you will either have to use “adb logcat” or “monitor” for Android devices or Xcode’s Devices screen for iOS. See: http://docs.coronalabs.com/guide/basics/debugging/index.html

Look at the messages and see if you can solve the problem. If not, please post the console long here.

Rob

Hmmm.

I don’t see anything on my Android phone(Galaxy S3?)

I play a sound when I call the ad listener function, so I know it’s being called.

But the screen is black.

I don’t really have any idea how to go about debugging on my phone instead of the simulator :slight_smile:

– Corona Ads listener function

local function adListener( event )

         – Successful initialization of Corona Ads

         if ( event.phase == “init” ) then

             – Show an ad

             audio.play(sndCya)

             --coronaAds.show( bannerPlacement, false )

             coronaAds.show( interstitialPlacement, true )

         end

end

Please read our debugging guide:

http://docs.coronalabs.com/guide/basics/debugging/index.html

If you wish to respond to @gmplayer, please do so on this thread:  https://forums.coronalabs.com/topic/64979-corona-ads-testing/

I’m not going to lock this once in case anyone wants to answer the OP or if the OP comes back with other questions.

Rob