Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

ads.isAdAvailable() is nil?
Started by Emre Sasmaz Oct 12 2016 08:53 PM

4 replies to this topic
vungle isadavailable
[TOPIC CONTROLS]
This topic has been archived. This means that you cannot reply to this topic.
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

Emre Sasmaz

[GLOBAL: userInfoPane.html]
Emre Sasmaz
  • Observer

  • 13 posts
  • Corona SDK

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

 

 

 

 



[TOPIC: post.html]
#2

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 25,461 posts
  • Enterprise

Moving to the Vungle forum.

 

Rob



[TOPIC: post.html]
#3

Emre Sasmaz

[GLOBAL: userInfoPane.html]
Emre Sasmaz
  • Observer

  • 13 posts
  • Corona SDK

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.



[TOPIC: post.html]
#4

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 25,461 posts
  • Enterprise

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.  



[TOPIC: post.html]
#5

Emre Sasmaz

[GLOBAL: userInfoPane.html]
Emre Sasmaz
  • Observer

  • 13 posts
  • Corona SDK

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.




[topic_controls]
[/topic_controls]