User Tools

Site Tools


This is an old revision of the document!


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.

AdManager has been tested with V3.01 and is supported on iOS and Android.

Adding Chartboost to the AdManager

  • Add 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.

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.

proton/admanager_chartboost.1341543252.txt.gz · Last modified: 2012/07/06 02:54 by seth