Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

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

181 replies to this topic
[TOPIC CONTROLS]
Page 2 of 8 1 2 3 4 »
This topic has been archived. This means that you cannot reply to this topic.
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#26

LairdGames

[GLOBAL: userInfoPane.html]
LairdGames
  • Contributor

  • 969 posts
  • Corona SDK

@Bldko: It seems to work fine for me. Not sure why it won't for some people like Renato. It works both in simulator (PC and mac) as well as in the devices (iphone5, iphone4 and ipad2 all OS 6+) I believe the notes says that It won't work for  OS 5 so watch that for that. All i did was to copy/past the code above (in my main.lua) , start a campaign and use show_ad() (not the timing one) in my gameOver.lua. I do not get 100% fill rate but not bad. My plan is to combine it with Revmob (and maybe even with Tap for Tap) so pretty much no matter what people will see an ad. Need more work on this implementation.

 

In short, yes it works for ME!

 

Hope this help.

 

Mo

 

ps: As I said before, I am using my Space Command ID (which is a live app) for it but my code is not integrated yet in Space Command. Not sure if that makes a difference.



[TOPIC: post.html]
#27

LairdGames

[GLOBAL: userInfoPane.html]
LairdGames
  • Contributor

  • 969 posts
  • Corona SDK

Here a screenshot of the ad showing on the simulator (on a Mac but not the xcode sim)

 

 

98yq1f.png

 

 

 

Mo



[TOPIC: post.html]
#28

Bladko

[GLOBAL: userInfoPane.html]
Bladko
  • Contributor

  • 342 posts
  • Enterprise

ok i made it working, this is list of steps you must do based on sample code from https://github.com/ChartBoost/corona-sdk

 

  • download sample SDK
  • create chartboost profile
  • create new app
  • copy its ID and its secret into your sample code
  • check app version and proper bundleID
  • Setup app in chartboost profile
    • set test mode first
    • set landscape or portrait
    • create publisher campaign for this app
    • add a test device to this campaign
  • run your app in corona simulator, should show test ad unit, remember that orientation is important
  • compile for device, remember about same bundleID
  • test on device, should  show test unit
  • turn off test mode in chartboost profile
  • should show ad unit
  • remember that in some countries / areas there are little campaigns so no ads will be displayed
    • in Poland there are no ads
    • i used US IP and i have plenty of different ads
  • make a test installation on a device by clicking ad and install an app
  • service is not real time so it will be recorded after some time (12 hours or so) in the dashboard
  • always use preload ad unit if possible
  • the end ;)

Btw i found a bug

  • If you show ad unit there a nice fade in the background gray from alpha 0 to alpha 1
  • if you close ad unit there is no fade out in the background gray from alpha 1 to alpha 0, this is Corona bug with overlay scene-board
  • speed of ad unit movement is very slow how to speed it up ?
  •  

Tom


 



[TOPIC: post.html]
#29

aukStudios

[GLOBAL: userInfoPane.html]
aukStudios
  • Corona Geek

  • 1,003 posts
  • Corona SDK

Thanks Tom for writing out the steps, that was helpful.

 

You're right about the background gray not fading out smoothly, I'm seeing the same issue.

 

Is anyone else also seeing an issue with letterbox scaling (not with the ultimate config.lua, just plain-old letterbox scaling)?  In letterbox scaling, the grey background won't fill the whole screen, only the area from (0,0) to (display.contentWidth,display.contentHeight).  Instead I think it needs to go from (display.screenOriginX,display.screenOriginY) to (display.contentWidth-display.screenOriginX,display.contentHeight-display.screenOriginY).

 

- Andrew

 

EDIT: I solved this by adjusting my config.lua.  Instead of this:

 

application = 
{
    content = 
    { 
        width = 320,
        height = 480,
        scale = "letterbox",
 
        fps = 60,
 
        imageSuffix =
        {
            ["@2x"] = 1.5,
            ["@4x"] = 3.0,
        },
    },
}
 
I now do this
 

application = 
{
    content = 
    { 
        width = 320 * (display.pixelHeight/display.pixelWidth>1.5 and 1 or 1.5/(display.pixelHeight/display.pixelWidth)),
        height = 480 * (display.pixelHeight/display.pixelWidth<1.5 and 1 or (display.pixelHeight/display.pixelWidth)/1.5),
        scale = "letterbox",
 
        imageSuffix =
        {
            ["@2x"] = 1.5,
            ["@4x"] = 3.0,
        },
    },
}

 
This has the benefit of always making screenOriginX,screenOriginY equal to 0,0 and display.contentWidth,display.contentHeight equal to the appropriate content dimensions for letterbox.


[TOPIC: post.html]
#30

LairdGames

[GLOBAL: userInfoPane.html]
LairdGames
  • Contributor

  • 969 posts
  • Corona SDK

1- Yes I can see that it is fade in when showing but fade out when i hide it. Not too critical at this time.

 

2- I also see that the gray out do not fill up the all screen (see my screenshot above). In my case it hides all the buttons so again not critical at this point but I would really prefer a full screen coverage of the gray out area. But how? I guess one way is to use the listener and draw a rectangle that would cover the all screen (with a touch event that go no where) and then use the listener to hide the faded rectangle when the ad is closed or touched..

 

I am glad more people are experimenting with it!

 

Mo



[TOPIC: post.html]
#31

LairdGames

[GLOBAL: userInfoPane.html]
LairdGames
  • Contributor

  • 969 posts
  • Corona SDK

cool! Your config does cover the all screen BUT in my case, all my assets are zoomed when I use your config. I am using ipad (1024/768 landscape) but also want to target iphone4,4s,5 and ipad2,3,4 Right now I am using:

 

 
application =
{
        content =
        {
                width = 768,
                height = 1024,
                
                xAlign = "center",
        yAlign = "center",
               scale = "letterBox",
                antialias = false,
               launchPad = false,
                audioPlayFrequency = 44100,
                fps = 60,
                imageSuffix =
                {
            
                  ["@2x"] = 1, -- for iPhone, iPod touch, iPad1, and iPad2
                    ["@4x"] = 2, -- for iPad 3, ipad 4
          
                },
        },
}
 

 

 

EDIT 1: If I use: (my base screen is 768/1024 (landscape)

 

 

 width = 768 * (display.pixelHeight/display.pixelWidth>1.5 and 1 or 1.5/(display.pixelHeight/display.pixelWidth)),

height = 1024 * (display.pixelHeight/display.pixelWidth<1.5 and 1 or (display.pixelHeight/display.pixelWidth)/1.5),

 

 

 

The assets are back to normal but then the Chartboost gray area won't cover the all screen anymore..

 

 

EDIT 2: using this:

 

 

width = 640 * (display.pixelHeight/display.pixelWidth>1.5 and 1 or 1.5/(display.pixelHeight/display.pixelWidth)), height = 960 * (display.pixelHeight/display.pixelWidth<1.5 and 1 or (display.pixelHeight/display.pixelWidth)/1.5),
 
 
It seems to be better (not perfect) but at least I do not get a zoom effect AND the Chartboost covers the all screen. I can see I need to re-adjust some of my assets but most of them are fine (i.e.: buttons..)
 
 
THANKS!!!!


[TOPIC: post.html]
#32

aukStudios

[GLOBAL: userInfoPane.html]
aukStudios
  • Corona Geek

  • 1,003 posts
  • Corona SDK

Hi Mo,

 

If you've set up your project with an assumption of 1024,768, then you should be able to modify my example config.lua to work.  Replace the 320 with 768, replace the 480 with 1024, and replace the 1.5's with 1.33333333333 (or better yet, 4/3, to avoid any rounding).

 

- Andrew



[TOPIC: post.html]
#33

aukStudios

[GLOBAL: userInfoPane.html]
aukStudios
  • Corona Geek

  • 1,003 posts
  • Corona SDK

cool! Your config does cover the all screen BUT in my case, all my assets are zoomed when I use your config. I am using ipad (1024/768 landscape) but also want to target iphone4,4s,5 and ipad2,3,4 Right now I am using:

 

 
application =
{
        content =
        {
                width = 768,
                height = 1024,
                
                xAlign = "center",
        yAlign = "center",
               scale = "letterBox",
                antialias = false,
               launchPad = false,
                audioPlayFrequency = 44100,
                fps = 60,
                imageSuffix =
                {
            
                  ["@2x"] = 1, -- for iPhone, iPod touch, iPad1, and iPad2
                    ["@4x"] = 2, -- for iPad 3, ipad 4
          
                },
        },
}
 

 

 

EDIT: If I use: (my base screen is 768/1024 (landscape)

 

 

 width = 768 * (display.pixelHeight/display.pixelWidth>1.5 and 1 or 1.5/(display.pixelHeight/display.pixelWidth)),

height = 1024 * (display.pixelHeight/display.pixelWidth<1.5 and 1 or (display.pixelHeight/display.pixelWidth)/1.5),

 

 

 

The assets are back to normal but then the Chartboost gray area won't cover the all screen anymore..

 

Hmm, somehow my reply went higher up in this thread.  Here it is again so it's at the bottom, easier to see the conversation:

 

 

Hi Mo,

 

If you've set up your project with an assumption of 1024,768, then you should be able to modify my example config.lua to work.  Replace the 320 with 768, replace the 480 with 1024, and replace the 1.5's with 1.33333333333 (or better yet, 4/3, to avoid any rounding).

 

- Andrew

 

 

EDIT: OK, my posts were actually going to the bottom, it just wasn't displaying right in my browser until I refreshed.



[TOPIC: post.html]
#34

LairdGames

[GLOBAL: userInfoPane.html]
LairdGames
  • Contributor

  • 969 posts
  • Corona SDK

Thanks Andrew. I made the changes and my graphics look good again. BUT right now Chartboost stopped feeding me ads so I have to wait they re-start again! When it happens I will be able to tell if the gray area fill up the screen or not. I will keep you posted as soon I can get an ad again..

 

Mo 



[TOPIC: post.html]
#35

RedBeach

[GLOBAL: userInfoPane.html]
RedBeach
  • Corona Geek

  • 1,132 posts
  • Corona SDK

I not succeed in putting the chartboost code to work last week. Today, I just ran the same code it started working. So, maybe Chartboost needed some time to enable my campaign....



[TOPIC: post.html]
#36

LairdGames

[GLOBAL: userInfoPane.html]
LairdGames
  • Contributor

  • 969 posts
  • Corona SDK

Yaaa! Great to know. Yes sometimes the app do not show ads for 30 mn to 1 hours but then it comes back and show almost at every game over. My guess, this is due to the fill rate not being 100%. Still a week is long time! When I first try it, the first ad I think show up pretty quickly (at least after I figure out that up I need it start a compaign!) Good news Renato. Mo

[TOPIC: post.html]
#37

codingcake

[GLOBAL: userInfoPane.html]
codingcake
  • Contributor

  • 124 posts
  • Corona SDK

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. 



[TOPIC: post.html]
#38

Naomi

[GLOBAL: userInfoPane.html]
Naomi
  • Corona Geek

  • 2,303 posts
  • Corona SDK

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


[TOPIC: post.html]
#39

aukStudios

[GLOBAL: userInfoPane.html]
aukStudios
  • Corona Geek

  • 1,003 posts
  • Corona SDK

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



[TOPIC: post.html]
#40

Naomi

[GLOBAL: userInfoPane.html]
Naomi
  • Corona Geek

  • 2,303 posts
  • Corona SDK

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

 

So, do I do something like this:

 

local function doThisThingNow()
    -- advance to the next screen
end
 
local delegate = {
   didCloseInterstitial = function(location) print("Chartboost: didCloseInterstitial " .. location); doThisThingNow; return end,
}

 

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.



[TOPIC: post.html]
#41

aukStudios

[GLOBAL: userInfoPane.html]
aukStudios
  • Corona Geek

  • 1,003 posts
  • Corona SDK

Awesome, no problem!

 

- Andrew



[TOPIC: post.html]
#42

LairdGames

[GLOBAL: userInfoPane.html]
LairdGames
  • Contributor

  • 969 posts
  • Corona SDK

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


[TOPIC: post.html]
#43

LairdGames

[GLOBAL: userInfoPane.html]
LairdGames
  • Contributor

  • 969 posts
  • Corona SDK

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



[TOPIC: post.html]
#44

Naomi

[GLOBAL: userInfoPane.html]
Naomi
  • Corona Geek

  • 2,303 posts
  • Corona SDK

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.



[TOPIC: post.html]
#45

LairdGames

[GLOBAL: userInfoPane.html]
LairdGames
  • Contributor

  • 969 posts
  • Corona SDK

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 



[TOPIC: post.html]
#46

ubj3d.android

[GLOBAL: userInfoPane.html]
ubj3d.android
  • Contributor

  • 741 posts
  • Corona SDK

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.



[TOPIC: post.html]
#47

Naomi

[GLOBAL: userInfoPane.html]
Naomi
  • Corona Geek

  • 2,303 posts
  • Corona SDK

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 



[TOPIC: post.html]
#48

LairdGames

[GLOBAL: userInfoPane.html]
LairdGames
  • Contributor

  • 969 posts
  • Corona SDK

Got it!

 

Thanks Naomi.

 

Mo



[TOPIC: post.html]
#49

Naomi

[GLOBAL: userInfoPane.html]
Naomi
  • Corona Geek

  • 2,303 posts
  • Corona SDK

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



[TOPIC: post.html]
#50

aukStudios

[GLOBAL: userInfoPane.html]
aukStudios
  • Corona Geek

  • 1,003 posts
  • Corona SDK

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




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