User Tools

Site Tools



Chartboost lets you tell your users about other games you've written by showing them big splash ads in a controlled way. You can specify that an ad is only shown once, or every day, or whatever. It's also possible to run ads for pay and track installs and bootups.

The AdManager Chartboost module has been tested with V3.01 to 3.1.1 and is supported on iOS and Android.

Requires an AdManager object to be setup to use.

Adding Chartboost to the AdManager

  • Add /shared/Ad/AdProviderChartBoost.cpp to your project

(Yes, it should be Chartboost and not ChartBoost but don't make me change it, svn makes it a hassle and it's already used in client projects that would break with this change..)

Add the following under your other #include's near the top of App.cpp:

	#include "Ad/AdProviderChartBoost.h"

Note, the #ifdefs I use are not really required here, but it's useful so you can turn on/off different ad systems easily for specific builds or platforms.

Next, add the following code under the existing m_adManager.Init() statement. (You did already setup AdManager, right?!)

	AdProviderChartBoost *pProvider = new AdProviderChartBoost;

	pProvider->SetupInfo("<insert chartboost appID>", "<insert chartboost appsignature>");

 	pProvider->CacheShowInterstitial(); //optional, but helps
	pProvider->CacheShowMoreApps(); //optional but helps

        //if you want to show an ad, do this:
        //If you want to show the Chartboost more apps page, do this somewhere else in your app:

Note: You'll need to replace the <chartboost id> and <insert chartboost appsignature> parts with the stuff you cut and paste from the Chartboost portal.

In your App.h, add the following somewhere so Chartboost will actually be used:


Great. But it should compile on Windows and pretend like it's working, but it isn't doing anything. To actually test it, you'll need to do an iOS or Android compile and setup the chartboost libraries. Here is how:

Enabling Chartboost for Windows Android build

These directions assume you are using the proton v2 android build system, which nearly all examples use now. You can look at RTAdManager for an example if needed.

First, download the Chartboost SDK files (you'll need a Chartboost account to see that option) and place chartboost.jar in the \shared\android\optional_src\libs\ChartBoost, which should exist already. I can't include this file in p+ for legal reasons.

* Add -DRT_CHARTBOOST_ENABLED to the SHARED_FLAGS variable in your /android/jni/ file, in case it isn't defined in your App.h
* Make sure shared/Managers/AdManager.cpp, shared/Ad/AdProvider.cpp, and shared/Ad/AdProviderChartBoost.cpp are added to your /android/jni/ file

In your build_prepare.bat, you should see this somewhere already:

:for Chartboost  (comment out the goto if you want to use it)
:goto skipchartboost;
set TEMPFILE=..\..\shared\android\optional_src\libs\ChartBoost\chartboost.jar

:Extra check to make sure we can locate the files
if exist "%TEMPFILE%" (
echo Located Chartboost files.
) else (
echo Cannot find the ChartBoost .jar file.  Download and place lib into shared\android\optional_src\libs\ChartBoost
..\..\shared\win\utils\beeper.exe /p
copy %TEMPFILE% libs

Change “:goto skipchartboost;” to “goto skipchartboost;”, this will cause the charboost.jar file to get copied to libs during the build process.

Next, edit your android/src/ and change




to enable it.

One last thing. Edit your android/AndroidManifest.xml and add the following somewhere for chartboost:

    <activity android:name="com.chartboost.sdk.CBDialogActivity"
android:launchMode="singleTop" >

That's it, Chartboost should work in your Android build now. Please note though, that unless you've setup an ad and a “campaign” in the Chartboost portal, nothing will show and you won't even know that it is working.

Enabling Chartboost for your iOS xCode build

First, download the Chartboost iOS SDK and put the contents in /shared/iOS/ChartBoost. (The directory will already exist)

  • Add the file /shared/Ad/ to your xCode project
  • Add the file /shared/iOS/ChartBoost/libChartboost.a to your xCode project
  • Add the file /shared/iOS/ChartBoost/Chartboost.h to your xCode project
  • Make sure RT_CHARTBOOST_ENABLED is being defined somewhere (either in the xcode preprocessor macros, or App.h)

If you compile and see an Apple Mach-O Linker error of _SCNetworkReachabilityCreateWithAddress then you need to do the following:

  • Add the SystemConfiguration.framework to your xCode project. (One way is to click + on the Link Binary With Libraries dialog under Build Phases, then find it in there)

If you compile and see an Apple Mach-O Linker error of _CFStreamCreatePairWithSocketToCFHost, then you need to do the following:

  • Add the CFNetwork.framework to your xCode project. (One way is to click + on the Link Binary With Libraries dialog under Build Phases, then find it there)

NOTE: As of 12/2/2012, you must also “weak link” to the AdSupport and StoreKit frameworks, and be using the iOS 6.X sdk as the base sdk. (runs on iOS 4.3 or higher) If you don't, it looks like it works but it doesn't show ads. The debug output will tell you that you need to link the libs though.

proton/admanager_chartboost.txt · Last modified: 2012/12/02 12:20 by seth