ads.isAdAvailable() is nil?

Hi, can somebody tell me why i’m getting crash with this code?

local ads = require( "ads" ) local provider = "vungle" local appId = "asdasdasdasdadasd" ads.init( provider, appId ) print(ads.isAdAvailable()) 

here is screenshot:

FVl1UFE.jpg

Moving to the Vungle forum.

Rob

Also i realized that listener doesn’t work.

listener\_test\_text=display.newText("", 100, screen\_sizey-150, 550, 0, native.systemFont, 20) listener\_test\_text.anchorX=0 listener\_test\_text.anchorY=0 local function xadsListener( event ) --{     if ( event.type == "adStart" and event.isError ) then     listener\_test\_text.text="Ad has not finished caching and will not play"     end     if ( event.type == "adStart" and not event.isError ) then     listener\_test\_text.text="Ad will play"     end     if ( event.type == "cachedAdAvailable" ) then     listener\_test\_text.text="Ad has finished caching and is ready to play"     end     if ( event.type == "adView" ) then     listener\_test\_text.text="An ad has completed"     end     if ( event.type == "adEnd" ) then     listener\_test\_text.text="Ended"     hint=hint+1     end     end --} ads.init( provider, appId,xadsListener )

Nothing changed. i can watch the ads video but listener doesn’t work.

You might want to put some print statements in there to verify.  

Require the json modules somewhere near the top:

local json = require("json")

Then the first line inside the listener do:

print( json.prettify( event ) ) 

Then look in the console log of your test device (remembers ad plugins have to be tested on a physical device) and see what’s happening.  

Thanks Rob, i will try it. Btw, as far as understand there is an issue about test mode of Vungle. I’ve activeted my application from vungle dashboard, and “cachedAdAvailable” is working now. But still no callback for “adEnd” and “adView”.

Edit: i don’t know how but it’s working now. Problem solved.

Moving to the Vungle forum.

Rob

Also i realized that listener doesn’t work.

listener\_test\_text=display.newText("", 100, screen\_sizey-150, 550, 0, native.systemFont, 20) listener\_test\_text.anchorX=0 listener\_test\_text.anchorY=0 local function xadsListener( event ) --{     if ( event.type == "adStart" and event.isError ) then     listener\_test\_text.text="Ad has not finished caching and will not play"     end     if ( event.type == "adStart" and not event.isError ) then     listener\_test\_text.text="Ad will play"     end     if ( event.type == "cachedAdAvailable" ) then     listener\_test\_text.text="Ad has finished caching and is ready to play"     end     if ( event.type == "adView" ) then     listener\_test\_text.text="An ad has completed"     end     if ( event.type == "adEnd" ) then     listener\_test\_text.text="Ended"     hint=hint+1     end     end --} ads.init( provider, appId,xadsListener )

Nothing changed. i can watch the ads video but listener doesn’t work.

You might want to put some print statements in there to verify.  

Require the json modules somewhere near the top:

local json = require("json")

Then the first line inside the listener do:

print( json.prettify( event ) ) 

Then look in the console log of your test device (remembers ad plugins have to be tested on a physical device) and see what’s happening.  

Thanks Rob, i will try it. Btw, as far as understand there is an issue about test mode of Vungle. I’ve activeted my application from vungle dashboard, and “cachedAdAvailable” is working now. But still no callback for “adEnd” and “adView”.

Edit: i don’t know how but it’s working now. Problem solved.