Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

How to switch between iAd and Vungle - A Solution :-)
Started by MAS1 Jul 30 2013 08:53 AM

6 replies to this topic
[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

MAS1

[GLOBAL: userInfoPane.html]
MAS1
  • Contributor

  • 279 posts
  • Corona SDK

Hi All,
 
Switching between iAd and Vungle is a must. I couldn't get this to work (see attached image).
 
After wrestling with this all afternoon I've managed to switch between the two using the following:

 

ads = require "ads"
ads.init("iads", "xxx", AdCallback) -- Bundle ID.
ads.init("vungle", "xxx", AdCallback) -- App ID.
ads:setCurrentProvider("iads")
.
.
.
ads.show("banner", {x = Screen.left, y = Screen.height})
.
.
.
ads.hide()
            
timer.performWithDelay(100, function()
        
   ads:setCurrentProvider("vungle")
   timer.performWithDelay(100, function()
        
      ads.show("interstitial")
   end, 1)
end, 1)

 

I should have arrived at this solution sooner rather than later as using timer delays has got me out of trouble numerous times with Corona.

 

You may also get this to work with a smaller delay or perhaps even removing one of the delays.

 

Hopefully Chartboost & Vungle combined will offset the diminishing RevMob eCPM I am experiencing. Kudos to Corona for putting more and more monetization options out there :-)

 

Hope this saves some hair pulling!

 

Best,

 

Martin.

Attached Files



[TOPIC: post.html]
#2

MAS1

[GLOBAL: userInfoPane.html]
MAS1
  • Contributor

  • 279 posts
  • Corona SDK

@Corona & Community

 

If I could change the thread title it would be:

 

How to switch between iAd and Vungle - No Solution :-( 

 

After further testing, the above technique of using a delay/delay(s) in fact fails to work at all now. 

 

Here's the log:

 

ads = require "ads"
ads.init("iads", "xxx", AdCallback) -- Bundle ID.
ads.init("vungle", "xxx", AdCallback) -- App ID.
ads:setCurrentProvider("iads")

 

<Warning>: event.response = The ad loaded successfully
<Warning>: event.provider = iAdsProvider
<Warning>: event.isError = false
<Warning>: event.type = nil
<Warning>: event.name = adsRequest
<Warning>: ********************************************
 
ads.hide()
ads:setCurrentProvider("vungle")
ads.show("interstitial")
 
I can and have put delays in the last 3 lines of code - to no avail.
 
<Warning>: event.response = nil
<Warning>: event.provider = vungle
<Warning>: event.isError = false
<Warning>: event.type = adStart
<Warning>: event.name = adsRequest
<Warning>: ********************************************
 
Vungle ad briefly appears for a frame or 2. Barely noticeable. The audio of the video ad can be heard.
 
<Warning>: event.response = nil
<Warning>: event.provider = vungle
<Warning>: event.isError = false
<Warning>: event.type = adEnd
<Warning>: event.name = adsRequest
<Warning>: ********************************************
 
<Warning>: event.response = nil
<Warning>: event.provider = vungle
<Warning>: event.isError = false
<Warning>: event.type = adView
<Warning>: event.name = adsRequest
<Warning>: ********************************************
 
Is appears that event.type = adEnd and event.type = adView are out of order!

 

As switching between iAd and Vungle is a must can Corona or a member of the community please post some code that works to perform the switch?

 

I'm using iOS 6.1.3 iTouch 4th gen Corona 1172 Build.

 

Martin.



[TOPIC: post.html]
#3

MAS1

[GLOBAL: userInfoPane.html]
MAS1
  • Contributor

  • 279 posts
  • Corona SDK

Vungle is now broke - at least for me.

 

I've removed any reference to iAds and tried to use Vungle alone. I now get no video (only audio on the 1st attempt).

I still get the event.type = adStart followed by event.type = adEnd and event.type = adView.

 

Anyone else having problems with Vungle?

 

Best,

 

Martin. 



[TOPIC: post.html]
#4

ingemar

[GLOBAL: userInfoPane.html]
ingemar
  • Corona Geek

  • 2,733 posts
  • Enterprise

I've been playing with Vungle for a couple of days without problems.

My devices are iPod Touch 3G, 4G and 5G + iPad mini and 2 Android devices. All without problems so far (Apple/Google/Amazon).

 

The order of your Vungle events do seem strange though. I don't use iAds, but switch between Chartboost/RevMob and Vungle.

I'll do some further testing now as I haven't done much today :-)



[TOPIC: post.html]
#5

MAS1

[GLOBAL: userInfoPane.html]
MAS1
  • Contributor

  • 279 posts
  • Corona SDK

@ingemar,

 

That's good of you to post up and test. Thanks.

 

I've returned to the code after a two hour break. My plan was to remove my app from the Vungle dashboard/portal in case of some mysterious invalid server-side state. 

 

Surprisingly and perhaps worryingly the Vungle video ad is now working with no change whatsoever to my code. :-(

 

Given your positive experience with it thus far - I'm going to try again to get iAd and Vungle working together.

 

I also contacted Vungle yesterday about another matter. Something I have experienced before with RevMob. The dreaded "Item not available". See picture. My concern here is that the CPI will not register. I'm UK based.

 

Hopefully they will get back to me.

 

Best,

 

Martin.

 

Vungle.png



[TOPIC: post.html]
#6

ingemar

[GLOBAL: userInfoPane.html]
ingemar
  • Corona Geek

  • 2,733 posts
  • Enterprise

Aha..*that* error.

 

I'm not sure what RevMob can do about it since it's the developer that ultimately decides in which stores that their apps are available. The developer can change that at any time as well.

Off the top of my head, one way would be that RevMob would have to ask every developer in which stores their apps are sold in and then filter out apps based on the IP address of the device requesting the ad.



[TOPIC: post.html]
#7

MAS1

[GLOBAL: userInfoPane.html]
MAS1
  • Contributor

  • 279 posts
  • Corona SDK

Okay, I think I've "got it"

 

First off (as stated by me above): "Vungle video ad is now working with no change whatsoever to my code"

 

Hangs head in shame. There was a change and it was the fly in the ointment. iAd and Vungle do in fact play nice together.

 

You simply cannot call ads.show("interstitial") without a delay in a native.showAlert() listener. I use 1000ms for the delay and it works fine. 100ms did not work fine!

 

Another gotcha is to be careful what UI buttons etc the user can touch/tap just before the ad is about to load. My app can bring up the native Twitter dialog if the user taps the Twitter button quickly just before the Vungle video shows. That results in a screen with some of the video and a keyboard - not pretty!

 

On a side note, one area of my apps where I try to idiot proof is what happens if the user/player taps a button/widget and just before there is a response, the user/player taps another button/widget. I've managed to crash/garble the display on sooooo many apps on iOS doing this. You usually have to be quick with the 2nd tap though! :-)

 

Same with transitions. A transition can be in progress and the user could tap a button/widget and all hell can break loose while the transition is transitioning from the previous touch/tap. I digress...

 

Looks like I can now use Chartboost and fallback to RevMob. iAd banners. Vungle to reward the player for some action. Who needs IAP?! :-)

 

Not sure at this stage about CPI with videos. Prefer the sound of CPC/CPM/CPCV as outlined here: http://forums.coronalabs.com/topic/37624-vungle-payment-based-on-install-rate/

 

As far as CPCV goes, I've disabled the close button in the Vungle dashboard that allows the user to close the ad. before completion. Time will tell if it's the right call! Easy to change back in the dashboard. I'll just have to experiment and see.

 

Best wishes,

 

Martin.

 

PS Forgot to add. The "Item Not Available" situation is a nail in the coffin for me as far as localisation goes. I don't use IAP. That would change if I did opt for IAP at a later date...




[topic_controls]
[/topic_controls]