Chartboost integration

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

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

to drop in my 2 cents…

first I have tried it with the READ_PHONE_STATE permission. it did show ads, but did NOT register my installs.

now I have the READ_PHONE_STATE removed (as written on github), and installs get recorded. the app is live and working.

Thanks @dingo, that’s great to know.

  • Andrew

Yes, thanks for testing and sharing with us. So my idea of using RevMob + Chartboost will not work (At least for Android)…

I have tested it on the iPhone and the test ads are showing but there is no real ads, but the didFailToLoadInterstitial which is fine.

Guess, there is no ads for Croatia.

How can I “trick” the system to another country (e.g. USA) ?

I would like to see how the real ads look like.

Hey, @dingo, thanks for letting us know.  Back to removing READ_PHONE_STATE permission and commenting out rotation scheme.

@ubj3d.android, got no idea how you could do it…