Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

CoronaProvider.ads.vungle.isAdAvailable() not working on android-
Started by jimprucey Aug 27 2013 05:43 AM

6 replies to this topic
ads.isadavailable() android ads vungle help
[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

jimprucey

[GLOBAL: userInfoPane.html]
jimprucey
  • Observer

  • 11 posts
  • Corona SDK

I have this functionality working on iOS very nicely using " ads.isAdAvailable() "

 

I cannot get this to work on Android , i've read there are some issues with android and that others have gotten it to work but I've tried everything

 

i need to test if there is an ad available before sending them to another screen

 

 
 
   local function listener( event )
           print( "listener called" )
     
           if (CoronaProvider.ads.vungle.isAdAvailable()) then
     
                        statusText.text = "ADS are available"
                        statusText:setTextColor (113, 255, 103 )
          else
                        statusText.text = "ADS are NOT available"
                        statusText:setTextColor ( 255, 49, 95 )
          end
 
  end
timer.performWithDelay( 1000, listener,0 )
 
 



[TOPIC: post.html]
#2

Naomi

[GLOBAL: userInfoPane.html]
Naomi
  • Corona Geek

  • 2,303 posts
  • Corona SDK

Hey, @jimprucey, a quick note to let you know that with my app, ads.isAdAvailable() is working fine on both iOS and Android.  Not sure why it's giving you issues...

 

Naomi



[TOPIC: post.html]
#3

jimprucey

[GLOBAL: userInfoPane.html]
jimprucey
  • Observer

  • 11 posts
  • Corona SDK

Thanks Naomi,

 

for taking the time to respond.

 

I read in another post that you could not get "ads.isAdAvailable()" to work on android so you switched to "CoronaProvider.ads.vungle.isAdAvailable()"

 

how did you fix this issue?

 

http://forums.coronalabs.com/topic/37663-coronaprovideradsvungleisadavailable/?hl=vungle

 

can you give me an example of how you use it in your code?

am I using it correctly?

 

on Android it always seems to return TRUE in the above example the statusText NEVER reads "ADS are NOT available".

 

I've tried "ads.isAdAvailable() ", I will try it once more.

 

Thank you again

Jim



[TOPIC: post.html]
#4

Naomi

[GLOBAL: userInfoPane.html]
Naomi
  • Corona Geek

  • 2,303 posts
  • Corona SDK

Hi Jim @jimprucey, I think you misunderstood what I wrote on the other thread.  I added Vungle to my Android build before I worked on adding it to iOS, and CoronaProvider.ads.vungle.isAdAvailable() worked fine on Android build at that time.  I then learned about ads.isAdAvailable(), so I went ahead and changed the code when I worked on iOS version, which worked fine.  And then, just yesterday, I went back to Android version, and it was the first time I confirmed that ads.isAdAvailable() worked on Android version too.

 

So, for me, both CoronaProvider.ads.vungle.isAdAvailable() and ads.isAdAvailable() worked on Android build, but now, I'm using ads.isAdAvailable() just so that it works on both iOS and Android.

 

About your code, I'm not sure.  Perhaps vungle ads are always available for you?  No?  Also, I don't use timer.performWithDelay in my code.  I just check the availability, and if it is available (that is, if it returns true), I show Vungle ad.  I think it stops being available if the app shows too many Vungle ads in a very short period of time (and then it become available again the next day.)  Otherwise, I have always seen Vungle ad being available for my app.  

 

So... perhaps you never see it not available because they are always available for you?

 
Naomi


[TOPIC: post.html]
#5

jimprucey

[GLOBAL: userInfoPane.html]
jimprucey
  • Observer

  • 11 posts
  • Corona SDK

Thanks Naomi,

 

maybe I misunderstood what ads.isAdAvailable() returns? I thought it was True if an ad was already cached and ready to show.

I'll try it without the timer.

 

I do really appreciate you taking the time

 

Jim



[TOPIC: post.html]
#6

Naomi

[GLOBAL: userInfoPane.html]
Naomi
  • Corona Geek

  • 2,303 posts
  • Corona SDK

Hi Jim @jimprucey, no, you have not misunderstood what ads.isAdAvailable() returns.  It returns either true or false (or at least that's how I use it anyway.)  And mine almost always returns true.

 

Naomi



[TOPIC: post.html]
#7

greg886

[GLOBAL: userInfoPane.html]
greg886
  • Contributor

  • 920 posts
  • Corona SDK

Hi guys - are you "ads.isAdAvailable()"?   Would I be right is assuming best approach re pseudo-code to be:

 

[1] PreCache Add Before you need it by calling "ads.isAdAvailable()".  So this would need to be done many seconds before you'll need.  Perhaps at the storyboard scene entry of the next level of a game?

 

 

[2] Checking availability when you go to show the ad? - How do you cover this off?  For example do you:

 

a) call "ads.isAdAvailable()" again for this check, or

 

b) do an ads:show() and then assume you'll get an immediate response to the listener with:  event.type == "adStart" and event.isError, that you can then use to stop and bypass the ad, or

 

c) do you have to build your own timer in if a) or b) don't work somehow?  

 

 

[3] PreCaching Subsequent Ads - do you have to call "ads.isAdAvailable()" again after showing an add to commence caching the next one in the background?

 

thanks

 




[topic_controls]
[/topic_controls]