CoronaProvider.ads.vungle.isAdAvailable() not working on android-

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

[lua]

   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 )

[/lua]

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

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

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

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

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

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

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

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

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

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

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

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