Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Chartboost integration
Started by hgbrian Jul 06 2013 06:10 PM

180 replies to this topic
[TOPIC CONTROLS]
Page 1 of 8 1 2 3 »
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

hgbrian

[GLOBAL: userInfoPane.html]
hgbrian
  • Pro
  • PipPipPipPipPipPip
  • 77 posts
  • Jedi

I am sure many people here will be interested to hear that I just got chartboost running on one of my Android apps today (not on Enterprise). 

 

If anyone wants to download and check that it's working ok I wouldn't say no...

https://play.google.com/store/apps/details?id=com.megafaunasoft.crystalcavernsfree

 

The chartboost code is beta and has some limitations but it seems to be working well so far (I've seen a couple of hours of impressions so far but no money:) ). 

 

Here's a step-by-step for a very basic integration. It shows an ad every four minutes max, which seems about right.

 

1. Download the new chartboost lua code from https://github.com/ChartBoost/corona-sdk

2. Copy the ChartboostSDK directory into your base directory

3. Add the following code to your main.lua (I just copied this from chartboost's main.lua)

local cbdata = require "ChartboostSDK.chartboostdata"
local cb = require "ChartboostSDK.chartboost"
local appId = <GET_FROM_CHARTBOOST.COM>
local appSignature = <GET_FROM_CHARTBOOST.COM>
local appBundle = "com.megafaunasoft.crystalcavernsfree"
local appVersion = "1.0"
local CHARTBOOST_INTERVAL = 240
local chartboost_clock

local delegate = {
    shouldRequestInterstitial = function(location) print("Chartboost: shouldRequestInterstitial " .. location .. "?"); return true end,
    shouldDisplayInterstitial = function(location) print("Chartboost: shouldDisplayInterstitial " .. location .. "?"); return true end,
    didCacheInterstitial = function(location) print("Chartboost: didCacheInterstitial " .. location); return end,
    didFailToLoadInterstitial = function(location) print("Chartboost: didFailToLoadInterstitial " .. location); return end,
    didDismissInterstitial = function(location) print("Chartboost: didDismissInterstitial " .. location); return end,
    didCloseInterstitial = function(location) print("Chartboost: didCloseInterstitial " .. location); return end,
    didClickInterstitial = function(location) print("Chartboost: didClickInterstitial " .. location); return end,
    didShowInterstitial = function(location) print("Chartboost: didShowInterstitial " .. location); return end,
    shouldDisplayLoadingViewForMoreApps = function() return true end,
    shouldRequestMoreApps = function() print("Chartboost: shouldRequestMoreApps"); return true end,
    shouldDisplayMoreApps = function() print("Chartboost: shouldDisplayMoreApps"); return true end,
    didCacheMoreApps = function() print("Chartboost: didCacheMoreApps"); return end,
    didFailToLoadMoreApps = function() print("Chartboost: didFailToLoadMoreApps"); return end,
    didDismissMoreApps = function() print("Chartboost: didDismissMoreApps"); return end,
    didCloseMoreApps = function() print("Chartboost: didCloseMoreApps"); return end,
    didClickMoreApps = function() print("Chartboost: didClickMoreApps"); return end,
    didShowMoreApps = function() print("Chartboost: didShowMoreApps"); return end,
    shouldRequestInterstitialsInFirstSession = function() return true end
}

cb.create{appId = appId,
    appSignature = appSignature,
    delegate = delegate,
    appVersion = appVersion,
    appBundle = appBundle}
cb.startSession()

function chartboost_cache_ad()
    cb.cacheInterstitial()
end
chartboost_cache_ad()

function chartboost_show_ad()
    if cb.hasCachedInterstitial() then
        msg = "Chartboost: Loading Interstitial From Cache"
    end
    print(msg)
    cb.showInterstitial()
    return true
end

function timed_chartboost_show_ad()
    print("timed_chartboost_show_ad")
    if chartboost_clock == nil or os.clock() > chartboost_clock + CHARTBOOST_INTERVAL then
        chartboost_clock = os.clock()
        chartboost_show_ad()
    end
end

4. Add this to an enterScene event...:

timed_chartboost_show_ad()

 

UPDATE: there is a bug where a change in orientation while the ad is showing will cause a blocking error. I've listed the bug on github. It seems like it should be easy to resolve. I would not advise using the module until it's fixed.



[TOPIC: post.html]
#2

LairdGames

[GLOBAL: userInfoPane.html]
LairdGames
  • Pro
  • PipPipPipPipPipPip
  • 960 posts
  • Jedi

THANKS! Fantastic share. I am assuming this will work the same way on IOS. Yes let's hope they can fix the glitch on orientation very soon. I am hoping to integrate Charboost as soon as I get some time. Your post will help tremendously! I do not know if your app is also on the ios store but I will think you would make more money with Charboost with ios. Just a guess on my part of course!

 

Thanks again.

 

Mo



[TOPIC: post.html]
#3

Naomi

[GLOBAL: userInfoPane.html]
Naomi
  • Pro
  • PipPipPipPipPipPip
  • 2,303 posts
  • Jedi

Thank you for sharing, @hgbrian!  I look forward to working on it, hopefully soon.

 

Cheers,

Naomi



[TOPIC: post.html]
#4

hgbrian

[GLOBAL: userInfoPane.html]
hgbrian
  • Pro
  • PipPipPipPipPipPip
  • 77 posts
  • Jedi

On the github page they say feedback is welcome at support@chartboost.com, so they may be interested to hear that people are excited to use the plugin (especially relevant since applovin just decided to stop supporting corona).

 

@LairdGames, yes the app is also on iOS but since it makes no money on Google Play I thought I could safely experiment there. I have tested it on iPad and it works fine (the orientation bug excepted.)



[TOPIC: post.html]
#5

LairdGames

[GLOBAL: userInfoPane.html]
LairdGames
  • Pro
  • PipPipPipPipPipPip
  • 960 posts
  • Jedi

Cool! Thank you. I will experiment as soon as possible!

 

Mo



[TOPIC: post.html]
#6

hgbrian

[GLOBAL: userInfoPane.html]
hgbrian
  • Pro
  • PipPipPipPipPipPip
  • 77 posts
  • Jedi

Another update...

The above code works when using the appId and appSignature supplied in chartboost's example code, so it's not a universal issue.

 

The difference seems to be that chartboost's appId/appSignature has its own visible custom frame where mine has no frame. It could be that when it tries to create the frameImage object it fails because there is no available graphic. 

 

I have spent a bunch of time trying to add custom frame graphics to my app but I can't find instructions on how to do it that work -- frustrating! I don't even know if the custom frame is uploaded to chartboost, or if the graphics live in my build.

 

------------------------------

I found where to upload custom frames (it's under "promote other apps" in the app description pane) and I added a chartboost's default green frame (I had to upload the portrait and landscape frames, and check the boxes for portrait and landscape in chartboost, even though my app is portrait only.)

 

Now it appears to work!



[TOPIC: post.html]
#7

LairdGames

[GLOBAL: userInfoPane.html]
LairdGames
  • Pro
  • PipPipPipPipPipPip
  • 960 posts
  • Jedi

Super cool! Can't wait to try it. I am surprised there are not much reaction to this since many of us were waiting this to happen... In any event, thank you for sharing this great news :) Mo

[TOPIC: post.html]
#8

LairdGames

[GLOBAL: userInfoPane.html]
LairdGames
  • Pro
  • PipPipPipPipPipPip
  • 960 posts
  • Jedi

I finally got a little bit of time today to experiment with Charboost and Corona. It seems that the test app on Github seems to work on the simulator but it seems to show so canned images rather than actual ads. I tried your main.lua above (with changing to my app ID from Chartboost) but unfortunately I am getting something like:

 

Chartboost: network reachability not supported on this platform  --- ****In the simulator only ***  
Chartboost: shouldRequestInterstitial Default?    
nil    
Chartboost: shouldRequestInterstitial Default?    
Chartboost: didFailToLoadInterstitial Default    
Chartboost: didFailToLoadInterstitial Default   
 
On the device, I see something about "app-environment"  not being correct (I will get the correct error later)
 
Not sure if you (@hgbrian) had any issue when your were playing around with the code. Please note that i am trying on IOS device since I do not have an android. Were able to test it without an app on the store? I am also assuming the code will not work on the simulator. On the device (iphone4) the screen is blank (no ads) I also try to use my current app on the store (app bundle) and got for it the two ID I need from Charboost but no luck so far!
 
Thanks for any pointers from anybody who tried this plugin.
 
Mo 
 
EDIT1: do I need to deal with the tax/payment issues before testing Charboost? I was just wondering....
 
EDIT2: I have noticed that you are showing the ad every 4 minutes. Any reason why? That seems to be a long time between shows? I thought it was better to show ads after maybe 2-3 plays. In any event I changed "timed_chartboost_show_ad()" to simply "show_ad()" and no ad so far. I did not use an enterFrame, I simply added show_ad() at the bottom of your code (main.lua) above 


[TOPIC: post.html]
#9

LairdGames

[GLOBAL: userInfoPane.html]
LairdGames
  • Pro
  • PipPipPipPipPipPip
  • 960 posts
  • Jedi

Quick question (not related to the code) Did you have to sign and mail the W-9 to Chartboost or did you simply email them the form? The reason I ask is that it seems that the W-9 has line for signature which would mean that I need to print the document and then send them to them. Sounds a little archaic but who knows.

 

Thanks for any pointers on that.

 

Mo 



[TOPIC: post.html]
#10

LairdGames

[GLOBAL: userInfoPane.html]
LairdGames
  • Pro
  • PipPipPipPipPipPip
  • 960 posts
  • Jedi

IT WORKS!!! I forgot to start a campaign! The ad showed on my device AND on the simulator :)   (windows machine) The ads look fantastic.i did not have to upload a new frame for some reason. i just selected both portrait and landscape (and set the default to landscape) I need to do more test on that point but maybe the difference is ios versus android?

 

The only things i need to figure out are:

 

1- How to integrate into my upcoming app (using storyboard) I will assume most code above will go into my main.lua and then use show_ad() on any module when needed

 

2- Why the dashboard not showing any $$ even so i downloaded and run an app. Delay?, test mode? my app not being on the app store yet?

 

3- Figure out if I need to actually sign the W-9 and physically send it to Chartboost? I hope not :) Maybe simply scanning my signature and send the form by email...

 

Other than that I am ready to go:) THANK YOU so much for the tutorial above. It really helped. I hope more people could try this plugin (very easy!) so we can get more experience with it. I am going to use it with Revmob (when Revmob has low $$ ads or did not load for some reason)

 

Cheers guys!

 

Mo



[TOPIC: post.html]
#11

LairdGames

[GLOBAL: userInfoPane.html]
LairdGames
  • Pro
  • PipPipPipPipPipPip
  • 960 posts
  • Jedi

Ok, I figured out 1 and 2. I got my first "$1"

Cheers.

Mo

EDIT: actually $2.88 for two installs...

[TOPIC: post.html]
#12

hgbrian

[GLOBAL: userInfoPane.html]
hgbrian
  • Pro
  • PipPipPipPipPipPip
  • 77 posts
  • Jedi

Hi Mo, 

I didn't do anything with tax forms yet -- I will wait until it goes above $10 before I worry about that:)

 

I am surprised you didn't see the issue I saw. I would do a quick check that rotating your device while showing a non-test ad doesn't cause a crash. If the non-test ad doesn't have a frame I would expect you to see the same problem...

 

I'll reevaluate the 4 minute thing too:) Probably too much time.

Brian



[TOPIC: post.html]
#13

LairdGames

[GLOBAL: userInfoPane.html]
LairdGames
  • Pro
  • PipPipPipPipPipPip
  • 960 posts
  • Jedi

Thanks for the info. Yes you are right, the minimum seems to be $300 so there is time:) I do not seems to get the issue you got for some reason. Did you try it on iOS device? When I change orientation, the ad change orientation. The only issue seems to be that the orientation looks very sensitive. Will switch between landscape and portrait very quickly with small change in orientation. It seems that there is setting to lock the app in one direction but not sure it works yet. The main issue is that I do not seems to get ads all the time so it is hard to test. Maybe it has to do about the test devices settings. I tried to set the $$ to zero so to accept all ads during the test phase. But not much luck. Still I can see live ads and they seems to be popular ones so that 's great! So far so good. Need more time test but I am getting impressions, installs and $. Thanks again! Mo.

[TOPIC: post.html]
#14

dingo

[GLOBAL: userInfoPane.html]
dingo
  • Starter
  • PipPipPipPipPipPip
  • 666 posts
  • Jedi

I just gave it a try on android and it really works. The layout is a bit messed up though.

 

to fix the rotation issue, i simply set the orientation to my app's orientation. the ad now still rotates, but it does not crash.

I can live with that.



[TOPIC: post.html]
#15

Renato - Red Beach

[GLOBAL: userInfoPane.html]
Renato - Red Beach
  • Pro
  • PipPipPipPipPipPip
  • 868 posts
  • Jedi

Hey guys. I can use some help. I am only getting the following error:

 

 

2013-07-11 21:15:03.282 Corona Simulator[74606:707] Chartboost: shouldRequestInterstitial Default?
2013-07-11 21:15:03.469 Corona Simulator[74606:707] Chartboost: didFailToLoadInterstitial Default
 

I already created an app and used the appID and appSignature in the code and also started an campaign.

 

If I use the same code but using the appID and appSignature of the Chartboost example it works fine. I don't know why it is not working with my app info. I also see in the dashboard the bootups and "install delivered" but in the device the add does not show.

 

I tested in Android and iOS and both give me the same error.

 

Best,

 

Renato



[TOPIC: post.html]
#16

LairdGames

[GLOBAL: userInfoPane.html]
LairdGames
  • Pro
  • PipPipPipPipPipPip
  • 960 posts
  • Jedi

Hi Renato.

 

Thanks for trying the plugin. We need more people to experiment with it. You could get that message ( i do not believe it is an error message but more like a status report)  for two reasons 

 

1- There are no ads available at this time

 

2- Your "finance" settings are wrong. In the compaign area you can set the minimum CPI and CPC that you will accept. You may want to check those.

 

I am using my own Chartboost settings and it works fine (both on the windows sim and the devices) I even started integrating it with Revmob on my upcoming app:

 

1- A start/resume, show full screen Revmob (show Chartboost if revmob fail)

2- After each game over show Chartboost (show Revmob if Chartboost fail) 

 

It works great so far but need more test.

 

For your issue, I will suggest you post your code without your Chartboost, maybe we can all have a look?

 

Good luck!

 

Mo



[TOPIC: post.html]
#17

Renato - Red Beach

[GLOBAL: userInfoPane.html]
Renato - Red Beach
  • Pro
  • PipPipPipPipPipPip
  • 868 posts
  • Jedi

Hi Mo.

 

Thanks for giving some tips. I already checked the CPC and CPI values and nothing... I can post the code but I am using the own Chartboost code. I just changed the appID and appSignature to my app ID/Signature....

 

What is funny is that the Chartboost dashboard is showing me statistics as I my app bootup and also showed ads, but in the device nothing happen (only that error message).

 

Renato



[TOPIC: post.html]
#18

whammy

[GLOBAL: userInfoPane.html]
whammy
  • Starter
  • PipPipPipPipPipPip
  • 201 posts
  • Jedi

@Renato, @LairdGames

 

I'm testing this Chartboost code in my two iOS apps - one is already available for sale,
the other one is not (although it has an iTunes bundle ID).

 

In the first app the same code works properly - the ads are being displayed.

In the second app the exact same implementation (w/different id) outputs the message:

 

 Chartboost: shouldRequestInterstitial Default?
 Chartboost: didFailToLoadInterstitial Default

 

Could you two confirm that this is the case in your apps?

That Renato's app is not ready for sale, and LairdGames' app is already in the App Store?

 

cheers,

Olaf

 

EDIT:

the ads in second app (the one which is not yet available) do work in the xcode simulator,
althought they don't display on the device. @Renato - do your ads work in the simulator?



[TOPIC: post.html]
#19

LairdGames

[GLOBAL: userInfoPane.html]
LairdGames
  • Pro
  • PipPipPipPipPipPip
  • 960 posts
  • Jedi

Hi,

That could be it! I used my app ID that is on sale BUT do not have the Chartboost code. That's a good point. So maybe using any app ID which is currently live would work. Again I can see ads on device and simulator (windows)
thanks again for your help.

Mo

[TOPIC: post.html]
#20

Renato - Red Beach

[GLOBAL: userInfoPane.html]
Renato - Red Beach
  • Pro
  • PipPipPipPipPipPip
  • 868 posts
  • Jedi

My app was already in sale and I am receiving the same error message that you are @whammy



[TOPIC: post.html]
#21

paskuniak

[GLOBAL: userInfoPane.html]
paskuniak
  • Basic
  • PipPipPipPipPipPip
  • 56 posts
  • Jedi

Ok, I figured out 1 and 2. I got my first "$1"

Cheers.

Mo

EDIT: actually $2.88 for two installs...

 

Hi Mo,

 

What did you figure out?

 

Also, do I have to set up a campaign even if I'm only interested in revenues and not cross promotion?

 

Thanks!



[TOPIC: post.html]
#22

LairdGames

[GLOBAL: userInfoPane.html]
LairdGames
  • Pro
  • PipPipPipPipPipPip
  • 960 posts
  • Jedi

Hi,

 

What I was talking about was that the fact that I was not getting ads because I did not start a campaign! I am not testing cross promotion so yes you need to start a campaign to get revenues from installs.

 

Hope this help.

 

Mo



[TOPIC: post.html]
#23

LairdGames

[GLOBAL: userInfoPane.html]
LairdGames
  • Pro
  • PipPipPipPipPipPip
  • 960 posts
  • Jedi

@Renato: Are you by any chance using the timed_chartboost_show_ad()????

 

If yes you may need to use show_ad() when you want to show an ad. In my case I have the code above (first post) in my main.lua BUT use show_ad() (not timed) in game over module. Time to time I do not see any ads but it is because they were none at the time. After a while I see ads again.

 

I hope we can figure your issue.

 

Mo



[TOPIC: post.html]
#24

dingo

[GLOBAL: userInfoPane.html]
dingo
  • Starter
  • PipPipPipPipPipPip
  • 666 posts
  • Jedi

what I really don't get is why my installs do not get paid. maybe its an android permission thing?



[TOPIC: post.html]
#25

Bladko

[GLOBAL: userInfoPane.html]
Bladko
  • Pro
  • PipPipPipPipPipPip
  • 342 posts
  • Jedi

what I really don't get is why my installs do not get paid. maybe its an android permission thing?

 

does sample app works for you guy ?

does it work on corona simulator or only on devices ?

any known problems on devices (both ios or android) ?

 

Regards

Tom




[topic_controls]
Page 1 of 8 1 2 3 »
 
[/topic_controls]