Before you begin:

Adding the SDK to your games is quick and easy – you just need a few ingredients:
  • A Chartboost account
  • An app in your dashboard
  • The latest SDK
  • An active publishing campaign
  • Please note that Chartboost supports Android 4.1+ and iOS 6.0, so make sure to set the minimum OS versions of your Unity project accordingly.
  • Also, to ensure compatibility with Android 6.0 Marshmallow devices and features, you should make sure that you’re building, compiling, and targeting against the latest Google Android SDKs (at least API level 23). (However, “minimum” SDK can still target down to API Level 16.)
The Chartboost initialization call must be made during hard and soft bootups within the first few seconds of your app launching, regardless of any other actions or user interaction within your app.
Publishers should call the setPIDataUseConsent API from the Chartboost SDK and pass in the appropriate value for whether consent exists, does not exist, or is unknown. Publishers are required as part of Terms of Service to obtain the consent from their users before Chartboost will process any personal data and pass it to the Chartboost SDK via the above method. This method should be called before startWithAppId.

Import the Chartboost Unity package into your project.

If you’re building for iOS, you can skip the Plugins/Android subdirectory; if you’re building for Android, you can skip the Plugins/iOS subdirectory. The files will be organized into a few different directories:
  • /Assets/Chartboost/Editor: Chartboost C# code for Unity Editor integration and the Postprocessbuildscript
  • /Assets/Chartboost/Resources: This folder contains the ChartboostSettings file, which contains the AppId and AppSignature for your iOS and Android apps
  • /Assets/Chartboost/Scripts: C# code for Chartboost use. All our public facing functions are present in Chartboost.cs, in this folder.
  • /Assets/ChartboostExample: An example scene that shows how to use the Chartboost SDK
  • /Assets/Plugins/iOS: Chartboost Objective-C code that helps to integrate it within Unity
  • /Assets/Plugins/Android: Chartboost Android library files
Want to jump right in? Take a look at the files in the ChartboostExample folder. Be sure to watch the log when testing the demo scenes, since some of the buttons will not have obvious effects.
Android: For complex integrations that replace the Android Manifest included in our plugin, any activities that show Chartboost ads must have the value android:hardwareAccelerated="true" in their activity entry on the Android Manifest, or video might not display properly.

If you’re publishing your game in the Google Play Store, link the Google Play Services library with your Unity project.

  • Go to Chartboost > Edit Settings and click Set Up Android SDK.
  • This will link the Google Play Services library with your Unity project, which is required for integrating the Chartboost SDK with Android games.
  • This also requires the Google Play Services library to be installed via the Android SDK Manager. See the Google Developers website for more information.

Add your app ID and app signature.

Remove fillers such as CB_AMAZON_APP_ID and CB_AMAZON_APP_SIGNATURE from the unused store fields or Unity will give you the following error:
W/Unity: CHARTBOOST: You are using the Chartboost Android example App ID! Go to the Chartboost dashboard
        and replace these with an App ID & App Signature from your account!
Chartboost App ID is a unique App identifier in our systems, therefore it is required to use a different Chartboost App ID per each app.

Drag and drop the Chartboost prefab found at /Assets/Chartboost/Chartboost into your Unity scene in the Scene view.

  • This prefab automatically handles basic SDK behavior like initialization using the app ID and app signature.
  • Tip: Drag the prefab into a scene that only runs once (such as a startup scene) for optimal performance.

To show an interstitial:

  • Include a using ChartboostSDK; reference at the top of each Unity .cs script that will call Chartboost methods.
  • Call the Chartboost class’ public functions present in the /Assets/Chartboost/Scripts/Chartboost.cs file. Check out ChartboostExample.cs in the sample project.
  • To show an ad, you can now call:
    // Show interstitial at location HomeScreen. 
    // See Chartboost.cs for available location options.
We strongly recommend that you cache your interstitials before showing them. Learn more about caching ▶
Prefetched videos (in total) only take up 30-50MB, even when you are using mediation.

If you’re building to iOS devices:

  • The first time you build your project, you should do a Build (not Build & Run) so everything is set up properly.
  • Once the build finishes, open the Xcode project that is created and make sure the StoreKit, Security and CoreData frameworks are linked in the Build Phases settings tab for your target.
Beware of inadvertently disconnecting StoreKit.framework (for example, by disabling in-app purchases) after Unity creates your Xcode project. The Chartboost SDK requires this framework to perform properly.

If you’re building to Android devices:

  • To build your project, do so directly to an APK file or export to an Android Project if you would like to make further modifications in Java.
  • If your app supports multiple orientations, adjust the configChanges settings in your <activity> tag to include these:
<activity android:name="com.chartboost.sdk.sample.SampleActivity"
Our latest SDK has fixed a compatibility issue with Google Play Services Rev.30. If you have already upgraded to Rev.31, please make sure your Google Repository is also up to date.

w00t! You just integrated the Chartboost SDK into your app!

Now you can start a campaign ▶

More SDK features

  • Chartboost Video: Monetize or acquire users with rewarded or interstitial video ads.
  • Caching: Speed up load times for interstitials, video, and MoreApps pages
  • Named Locations: Fine-tune campaign targeting and interstitial frequency by location. (Note that Named Locations are mandatory as of SDK 5.0.)
  • Delegate Methods: Further tailor Chartboost behavior in your app
  • SDK Configuration Methods: Access Chartboost SDK functionality and settings.


    void Start() {
     // Set the consent status corresponding to the user's response using 
     // the Chartboost.setPIDataUseConsent(CBPIDataUseConsent.YesBehavioral); method.

You might also like…