Add your mobile game to the Chartboost network with just 10 lines of code!
|Download SDK||How to Integrate|
|v6.6.1 (for iOS 6.6.1 and Android 6.6.1)
How big is the SDK?
|I'm using Unity 3.x or older||Upgrade my current SDK||Release Notes|
|What's in the box? Our SDK package comes fully loaded with features.|
High-quality video ads specially tailored for games to reward your players!
Customizable interstitials that give your players a seamless in-game experience!
A robust analytics suite to target your best possible audience!
Ready to integrate the Chartboost SDK? Let's do this!
- Before you begin
- Importing the Chartboost Unity package
- Linking the Google Play Services library
- Adding the app ID and app signature
- Adding the Chartboost prefab into your Unity scene
- Showing interstitials
- Building to iOS devices
- Building to Android devices
- More SDK features
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 2.3+ 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 9.)
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: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.
- Go to Chartboost > Edit Settings.
- Add your app ID and app signature. How do I find my app ID and app signature?
CB_AMAZON_APP_SIGNATUREfrom 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!
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. Chartboost.showInterstitial(CBLocation.HomeScreen);
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
CoreDataframeworks are linked in the Build Phases settings tab for your target.
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
configChangessettings in your
<activity>tag to include these:
<activity android:name="com.chartboost.sdk.sample.SampleActivity" android:label="@string/app_name" android:configChanges="keyboardHidden|orientation|screenSize">
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.
- MoreApps page: Create and customize a "see more games" page in your app to advertise your own games or publish ads for other developers' games.
- Post-Install Analytics: For games with in-app purchases. Unlock useful data about players' buying behavior to optimize campaigns or retargeting.
You might also like...
- Common errors and solutions when integrating the SDK for Unity