Chartboost integration

Hi :

  I just spend all day try chartboost today .

Here is my personal result.  (My country is in Asia)

  The fill rate of Android are not very good out side of America (Compare with Revmob ) . Today I try it on 5 android devices. first , it show ads ok . after 1 hour  it always show

    Chartboost: shouldRequestInterstitial Default?
    Chartboost: didFailToLoadInterstitial Default?

I spend a lot time to find what’s going on . after few hours , it working again for maybe 30 mins .  

In iOS , the status is better then Android .  

Tonight . I try it via US VPN . It work fine . even on Corona simulator it works.  

I really no idea what’s the rule . all I can sure that iOS in USA will be work well .

So, If I suggest others have backup ads solution on android app out side of USA , If Chartboost fail to load ads . you can switch to other ads. 

Thank you all for sharing and posting your experiences here.  I’m finally getting around to incorporating Chartboost, and the sample code up top on the first page, as well as step by step things to do, plus things to look out for and different experiences – they really helped.  I got mine up and working… some what.

The problem I have, though, is for interstitial ads.  I don’t see how we may get the callback from the Chartboost.  On Chartboost website, under Campaign > Network Publishing Campaign > Advanced Settings, I see a mention of callbacks, but I’m not sure if it’s integrated with chartboost-corona-sdk.  I grabbed it from github today, but I don’t see any mention of the callback listener anywhere.

I need a callback listener to let my app know whether or not (1) ad was served (if it’s not filled, I’d show another ad), and (2) user closed the ads or clicked on the ads (based on which my app would advance to the next screen.)   Without the callback to let me know the #2, my app just end up hanging.

I thought of using timer to auto-advance to the next screen (or immediately after showing ads, advance the screen), but it looks terrible, because it ends up showing the next screen behind the ad.  I guess if the interstitial ads are truly full screen, it would not be an issue, but with Nexus 7, it really isn’t full screen.  (And I suspect many Android device will have the same issue.  I haven’t checked iOS version yet, though.)

So how do we deal with this?  

Naomi

Hi Naomi,

The callbacks referred to on the website are a different concept.

For callbacks with your app, use the “delegates” (another word for callback) described in the GitHub page: https://github.com/ChartBoost/corona-sdk.  You have to register your delegates when you setup the ChartBoost session, instead of each time you make an ad request.

  • Andrew

Hey, Andrew @aukStudios, thank you for letting me know.  That’s really helpful.  

So, do I do something like this:

[lua]

local function doThisThingNow()

    – advance to the next screen

end

local delegate = {

   didCloseInterstitial = function(location) print("Chartboost: didCloseInterstitial " … location); doThisThingNow; return end,

}

[/lua]

Naomi

Edit:  while editing my post, hitting tab or enter ended up posting it before I finished writing it up.  Oh well…

Edit 2:  And yeah, I see.  I read the usage #4 on github, and it’s pretty clear what to do.  Thanks again, Andrew, for pointing it out for me.

Awesome, no problem!

  • Andrew

Hello Naomi.

I think you got it but yes just delegate. Earlier in my implementation I used this to test it and it worked flawlessly:

<lua>

didFailToLoadInterstitial = function(location)print("Chartboost: didFailToLoadInterstitial " … location); native.showAlert( “Chartboost”, “Ad failed to load!”, { “OK” } );  return end,

    

    didDismissInterstitial = function(location) print("Chartboost: didDismissInterstitial " … location);native.showAlert( “Chartboost”, “Ad dismissed!”, { “OK” } ); return end,

</lua>

Thanks guys, for the share, it seems that Chartboost has now a full tutorial as well. I was not aware of it. I was using the tutorial code at the beginning of this thread. Should I switch to the git hub code even so my code seems to work fine as is?

Cool stuff!

Mo

Quick question, I have been reading the git hub tutorial but you guys can help (my brain is not working today:) Anyway to programmatically force Chartboost to stay on landscape mode? Right now it seems to be very sensitive to the position of the device. I can move the device just a little and the ad switch to portrait mode (still look ok) but annoying!

Thanks.

Mo

Hey, Mo, I don’t see any issue with downloading the latest chartboost-corona-sdk from github, but I also don’t see why you’d have to change your code.  That said, I do not include any ads related code in my main.lua – instead, they are all in my showads.lua file that handles all ads.  So it really depends on how you want your code organized.

Naomi

P.S.,  BTW, to format your code, you don’t use <lua> </lua> tag any more.  Instead, you use square brackets.  Check “Post Formatting Tips” button for more info.

Thanks Naomi. Nice to now about the code formatting.

I like your idea of having a module for ads! Do you just put all the code (chartboost init code) in there and then in the module you need to call an ad you require show ads and then use show_ads()? That sounds better than implementation (in main.lua) I guess I could even dump both chartboost and revmob in there (showads.lua) and then have function in there called showChartboost() and showRevmob() What do you think?

Thanks again,

Mo 

Didn’t know we can use Chartboost in Corona!

I just implemented it and it works, got a test ad in the simulator.

Shall see how it works on a device and with real ads.

Mo, I put all the code in showads.lua file of mine.  I call a function that sounds like showads.initads() once in my menu.lua (and once it’s called after the app is launched, it won’t be called again even after the user returns to menu screen.)  And inside my showads.lua, I have a function that sounds like M.initads(), which initializes all ads.  I then have a function that sounds like M.show, which handles displaying the ads for me when showads.show() is called from other game modules.

Naomi 

Got it!

Thanks Naomi.

Mo

Yikes, I noticed on Chartboost github page, it says:

Android:  This won’t work if you have the android.permission.READ_PHONE_STATE permission enabled.

But for AdMob it sounds like android.permission.READ_PHONE_STATE permission must be enabled:

http://docs.coronalabs.com/daily/api/library/ads/init.html

Does this mean I can’t use AdMob (or inneractive or inMobi) along with Chartboost?  This means, if I want Chartboost, I can only pair it with my house-ads only?  Ugh.

Have anyone tried pairing Chartboost with AdMob – and does it work without READ_PHONE_STATE permission (just in case Corona doc is outdated, and hoping AdMob doesn’t really need READ_PHONE_STATE permission…)

Naomi

Hi Naomi,

I’m pretty sure that comment on the ChartBoost GitHhub page is a typo.  I think they meant to say it won’t work if you don’t have that permission enabled (i.e., you must have it enabled).  I have it enabled, and it works fine.

  • Andrew

@ingemar. THANKS!  I was also using both without knowing:)

@Dingo: 7000 impressions/$10 is that Chartboost or Vungle? Android?

Mo

Hey, Andrew, thank you for letting me know.  Ugh, I was going to remove the permission.  So, you do see payment/revenue from Android version with the READ_PHONE_STATE permission enabled, right?  I don’t want any surprises, so please do confirm.  I’d so appreciate it.

Thanks again.

Naomi

Hi Naomi,

What I can say is that the module delivers ads and doesn’t crash when READ_PHONE_STATE is enabled.  I haven’t tried it, but I highly suspect that if you don’t have that permission, it’ll just crash or not deliver any ads.

In terms of payment/revenue, I tried one install on iOS and one on Android.  The iOS install did show up, though only for $0.04.  The Android one hasn’t shown up yet.  That’s not very encouraging, but install tracking is always a quirky business, so I’ll try it again, probably tomorrow.  (I don’t think missing installs would have anything to do with the permissions setting.)

In any case, the module is still listed as beta, so it’s certainly as use-at-your-own-risk/discretion situation.  I plan to test it quite a bit more before I decide whether or not to use it.

  • Andrew

Well I stand corrected.  If I remove READ_PHONE_STATE, it still runs fine and still displays ads.

I notice that the GitHub page has been updated and is more clear that READ_PHONE_STATE shouldn’t be enabled.  (It was written in a way before that made it look like a typo, whereas now it’s very clear about it.)

I’ll email ChartBoost about it, since it’s still a bit strange.

  • Andrew

Thank you, Andrew.  I sent email to Chartboost too, citing the github url.  Yes, I had tried both, with & without READ_PHONE_STATE permission, and it did not crash or cause any issue in terms of user experience on device, so I figured one of which would register ad impression, clickthrough and/or installs properly while the other wouldn’t.

Please let me know when you hear back from Chartboost.  I’ll post if/when I hear back from them too.  

Meanwhile, I’m reverting all my code back to include READ_PHONE_STATE permission plus rotation with other ad providers.  But how frustrating this is.

Naomi

Update:  I heard back from Chartboost:

The reason the Corona SDK won’t work with that permission enabled is that it prevents the return of Android IDs, which our system needs to receive.

The following is from Corona’s documentation (http://docs.coronalabs.com/api/library/system/getInfo.html)::slight_smile:

"On Android, if your app uses the “android.permission.READ_PHONE_STATE” permission, then the following will be returned:

IMEI for GSM phones.
MEID or ESN for CDMA phones.
The operating system’s unique id for devices that are not phones."

My guess is that it has to do with what system.getInfo(“deviceID”) returns.  According to http://docs.coronalabs.com/api/library/system/getInfo.html, what it returns on Android differs depending whether the permission is enabled or not, so I suspect ChartBoost depends on it being the OS-assigned ID (in which case, including the permission might actually affect ChartBoost’s ability to give credit for an install, different from what I thought earlier).

  • Andrew