Chartboost integration

@ingemar. THANK YOU! It makes a lot sense. Cheers. Mo

Hi everyone!

im trying to use a Charboost+Admob combo on android, but i see there is a problem with permissions. i tested both in my app with READ_PHONE_STATE included: admob worked perfectly while chartboost registred impressions and clicks but no downloads. Now i removed that permission, and if what you said before is correct, charboost should start showing downloads, right? (i gonna test it later). but what about admob? on the corona sdk reference page, it says that the READ_PHONE_STATE permission must be included, but it doesn’t specify for which ad provider (for example, it could only be needed for inmobi but not admob). Also, the official admob documentation (https://developers.google.com/mobile-ads-sdk/docs/#android) doesn’t require the READ_PHONE_STATE permission, so i guess it should work also without it? can anybody with android confirm this? i’m gonna update you later about my dicoveries.

I haven’t used that combination myself (yet), but if the official Admob docs don’t specify it as required, then I’d say that you should be safe…

Hi  guys,

As you know, I have been working on integrating Chartboost, Vungle (video ads) and Revmob on the same app (my old Space Command!) Anyway, i am wondering if any of you guys would like to help me test the ads showing logic of the app before I send it to Apple for review.

Here the link to join this beta testing of the ads logic:

http://tflig.ht/I17cpp

There are two ads showing logic in the works. One for the app start/resume and one for the end of each game.

1- The first time the app launch, there is no ad showing.  Once you play one game then a Chartboost ad should be shown at every app resume/start. If Chartboost is not available then Revmob should be seen.

2- Once the game is over, you should see:

A video ad (Vungle)  IF vungle is not available then Chartboost ad will be shown. IF Chartboost is not available then the app is suppose to show you a Revmob ad (full screen) Finally if Revmob is not available then nothing happens and you can play the game again. I put Revmob at the end because it has basically 100% fill rate.

You will also noticed that i am using a native wheel to indicate something happening before each ad showing. This was done to keep the player from starting a game before an ad is finish showing for instance. That wheel should go away if the ad is showing (or not with some delay)

I am also making the ad show after EACH game. in the final version I am only showing an ad after 3 game plays. This only for you to test the ad showing without having to play 3 games!

I am really interested in the ads showing logic described above.  Please let me know if the app crashes or hang at any time.

THANK YOU!

Mo

@Edvard Arutyunyan, @Ingemar: THANK YOU so much for taking the time to join the testflight to test the vungle/charboost/revmob integration. I really appreciate!

I build a version with your profiles and send it to you guys. Please let me if any have issues.

Thanks again :slight_smile:

Mo

I’ve found a few issues. I’m preparing a separate email with my results.

Thanks ingemar! I got the report. I need to look at that Facebook issue. Too late right now but I will look into tomorrow after work. Thanks so much for taking the time to test and report the issue. Cheers. Mo

Is there an official Chartboost plugin coming?

@ingemar: Thanks so much. I think i found the issue that you raise in your testing. It seems that we now need to add an extra line code in the builds.settings like"

FacebookAppID = “1234567890” where 1234567890 is the facebook ID of course. It used to be that we only needed the line:

“fb1234567890”

Once I added the FacebookAppID, the app actually launched the Facebook app (installed) and then came back to my app. I then saw that it was actually posting to my Facebook page. It was not posting before I added that line. Not long sure it was broken but I am so happy you were able to spot that! You seem to have some great eagle eyes :slight_smile:

Anyway here the link for more info. I hope it will help someone else.

http://www.coronalabs.com/blog/2013/07/30/understanding-facebook-authentication/

THANK YOU!

Mo

I’m glad that you were able to get it to work!

In my previous job I used to test code from my team before releasing to production. Even though it’s been a while, I’m still used to finding stuff that doesn’t behave properly :slight_smile:

Hello Ingemar! Could you please explain how did you fix the ad background cover issue?

Thanks is advance!

No problem!

Below you’ll find my Chartboost code from my ad network module.

First, my config.lua is set up to use letterbox with a single width/height specified:

-- config.lua local dFPS = require("dynamicFPS"); application = { content = { width = 320, height = 480, scale = "letterbox", fps = tonumber(dFPS.currentFPS()); antialias = false, xalign = "center", yalign = "center", imageSuffix = { ["@2x"] = 1.4, ["@2x~ipad"] = 3.4 } } }

(NOTE: The code below is tightly integrated with my own frameworks, so it’s not possible to just copy/paste the code into your own projects, however the logic is straightforward, so you should be able to cherry-pick)

For Chartboost, I have two local variables that control the additional overlays (overlay1, overlay2), and two functions that control the creation/removal (createOverlays, removeOverlays).

I also have a local variable which is important in this context called ‘screen’. It holds the current screen coordinates and is defined as follows in my framework:

local deviceScreen = { left = display.screenOriginX, top = display.screenOriginY, right = display.contentWidth - display.screenOriginX, bottom = display.contentHeight - display.screenOriginY } deviceScreen.width = deviceScreen.right - deviceScreen.left; deviceScreen.height = deviceScreen.bottom - deviceScreen.top;

The overlays are controlled through the Chartboost delegates. The delegates to watch are shouldDisplayInterstitial, didDismissInterstitial and didFailToLoadInterstitial. The code below mimics the Chartboost fade-in/out timing exactly.

-- ------------------------------------------------------------------------ -- ChartBoost -- ------------------------------------------------------------------------ local CHARTBOOST\_APPID = { Apple = {ID = "a", SIG = "aa"}, Google = {ID = "b", SIG = "bb"}, Amazon = {ID = "c", SIG = "cc"} } local chartboost = nil; -- Chartboost handle local overlay1 = nil; -- temporary overlays for chartboost background local overlay2 = nil; local removeOverlays = function() local destroyOverlay = function(object) object:removeEventListener("touch", object); object:removeEventListener("tap", object); object:removeSelf(); end if (overlay1) then destroyOverlay(overlay1) end; if (overlay2) then destroyOverlay(overlay2) end; overlay1 = nil; overlay2 = nil; end local createOverlays = function() local configOverlay = function(object) function object:touch(event) return true; end function object:tap(event) return true; end object:setFillColor(0, 160); object:addEventListener("touch", object); object:addEventListener("tap", object); object:toFront(); transition.from(object, {time=600, alpha=0}); end removeOverlays(); -- remove old overlays in case they are still there if (screen.left \< 0) then overlay1 = display.newRect(screen.left, screen.top, math.abs(screen.left), screen.height); overlay2 = display.newRect(screen.right+screen.left, screen.top, math.abs(screen.left), screen.height); end if (screen.top \< 0) then overlay1 = display.newRect(screen.left, screen.top, screen.width, math.abs(screen.top)); overlay2 = display.newRect(screen.left, screen.bottom+screen.top, screen.width, math.abs(screen.top)); end if (overlay1) then configOverlay(overlay1) end; if (overlay2) then configOverlay(overlay2) end; end local chartboostDelegate = { shouldRequestInterstitial = function(location) return true; end, shouldRequestInterstitialsInFirstSession = function() return true; end, shouldDisplayInterstitial = function(location) if (flags.canShowAds()) then createOverlays(); flags.pauseGame(); flags.cancelAllTouches(); M.isActive = true; return true; else return false; --ignore ad end end, didDismissInterstitial = function(location) timer.performWithDelay(600, removeOverlays); M.isActive = false; return; end, didCloseInterstitial = function(location) M.isActive = false; return; end, didFailToLoadInterstitial = function(location) M.isActive = false; removeOverlays(); if (revmobFallback == "popup") then M.showRevmobPopup(); else M.showRevmobFullscreen(); end return; end, didClickInterstitial = function(location) M.adTapped = true; M.isActive = false; return; end } local chartboostInit = function() chartboost = require("ChartboostSDK.chartboost"); flags.bundleid = "com.company.myapp"; chartboost.create{ appId = CHARTBOOST\_APPID[directives.STORE].ID, appSignature = CHARTBOOST\_APPID[directives.STORE].SIG, delegate = chartboostDelegate, appVersion = settings.version, appBundle = flags.bundleid }; M.showChartboostFullscreen = function(fallback) revmobFallback = fallback; if (not M.isActive) then chartboost.showInterstitial(); else print("chartboost: ad is active"); end end end M.startChartboostSession = function() chartboost.startSession(); end -- ------------------------------------------------------------------------

Hope this helps…

Whoa! Thank you! I got your logic! 

I am not sure if I am hijacking the thread or not, I think I have lost track of it’s original purpose; but there you go, a Chartboost integration question.  In their main.lua example implementation I see the following code:

– test the special sdk data methods

cbdata.cacheInterstitialData(“Default”,

    function(response)

        local ad_id = response[“ad_id”]

        local link = response.link

        print ("Success requesting ad: "…tostring(link))

        cbdata.showInterstitialData(ad_id,

            function(response)

                print("Success showing ad "…ad_id)

            end,

            function(error)

                print("Error showing: "…error)

            end)

        end,

        function(error)

            print("Error requesting: "…error)

        end)

It appears to be linking to a cbdata module and it appears to be some kind of lispener/call back.  Does anyone know what it is for?   Maybe I am being really dumb and I am just not finding the relevant documentation. Thanks a lot in advance.  

I’ve seen that myself, but haven’t experimented with it. I’ve found no docs about it either.

Unless somebody replies on this thread, you could shoot an email in their direction and ask. In my experience they’re quite quick in responding to emails…

@ingemar – I have done that now.  If I get anything useful out of them I will share anything that is relevant.  As you have suggested earlier in this thread, I am going to give it a go at the idea Vungle/Chartboost/RevMob.  Vungle done, Chartboost and RevMob to go :) .  There are clear documents for Unity, iOS and Android: are we really so few the Corona developers?  Don’t we deserve some attention?  :)

https://github.com/ChartBoost/corona-sdk

I downloaded the sample above. I’m only interested in interstitials, but when I ran it in the Corona Simulator, hit Preload Interstitial and then Show Interstitial , it worked twice and then nothing. Even if I relaunch the Simulator, it no longer works.

When you are in Corona Simulator, are you supposed to view this in the Xcode Simulator (Build>iOS>Build for>Xcode Simulator)? Chartboost ads are the only ones not working right using just the Corona Simulator.

They keep track of which ads that have been recently shown on a particular device and geographic region. 

When all ads in their inventory for that device/region have been exhausted, no ads will show up for a few hours. 

You can implement several ad networks and listen for the ‘didFailToLoadInterstitial’ event to show an ad from another network.

Generally, few ads are available when running in any simulator (Corona or Xcode). You should get more ads available when running on an actual device.

Makes sense.

Thanks ingemar

I uploaded custom frames, but they appear fuzzy.  If any of you are using custom frames, I’d so appreciate hearing what file format you chose for it to work properly.  (Do they accept vector graphics?  Is that the way to make it not to appear fuzzy?)

Naomi