Get Started on Android

Before You Begin 🔗

  1. Create and set up your Chartboost account
  2. Download and review the Chartboost Sample App

Amazon integration uses the same SDK as Android. These integration instructions apply to games for Google Play or the Amazon App Store.

Minimum Supported Development Tools 🔗

Software Version
Minimum Supported Version API 19 (Android 4.4 KitKat)
Compile Version API 35
Gradle 8.2
Kotlin 1.9.21
Recommended Java 17

Runtime Permissions 🔗

Refer to the Android Developers documentation for details on how to declare and handle both normal and runtime permissions.

Required normal permissions:

  • android.permission.INTERNET
  • android.permission.ACCESS_NETWORK_STATE

Recommended optional runtime permissions (allows the SDK to handle calls that interrupt video playback):

  • android.permission.READ_PHONE_STATE

Setting Up Chartboost SDK 🔗

1. Add the Chartboost repository and dependencies with the following code to your Gradle file. 🔗

repositories {
	mavenCentral()
	maven { url 'https://cboost.jfrog.io/artifactory/chartboost-ads/' }
}

dependencies {
	implementation 'com.chartboost:chartboost-sdk:9.14.1'
}

2. Add the Google Play Services Library as a dependency of your project. When you use our latest SDK, you will need “play-services-base” and “play-services-ads-identifier”. 🔗

  • The Google Play Services library has its own set of integration instructions, including additions to your Android Manifest and ProGuard configuration.
  • Follow Google’s instructions to integrate the Play Services Library.
  • You should then find something similar to the following two lines in your build.gradle file:
implementation "com.google.android.gms:play-services-base:$project.ext.googlePlayServicesVersion"
implementation "com.google.android.gms:play-services-ads-identifier:$project.ext.googlePlayServicesVersion"

3. Add the following attribute to activities in the AndroidManifest.xml file if you display Chartboost ads with multiple orientations in those activities. This will help smoothen video playback during orientation changes. 🔗

android:configChanges="keyboardHidden|orientation|screenSize"

4. Import the Chartboost SDK into any activity that uses Chartboost with the following: 🔗

  • import com.chartboost.sdk.Chartboost 
    import com.chartboost.sdk.ads.Interstitial 
    import com.chartboost.sdk.ads.Rewarded 
    import com.chartboost.sdk.ads.Banner
    
  • import com.chartboost.sdk.Chartboost;
    import com.chartboost.sdk.ads.Interstitial;
    import com.chartboost.sdk.ads.Rewarded;
    import com.chartboost.sdk.ads.Banner;
    

If you’re using additional SDK features, you’ll also want to import these activities:

  • import com.chartboost.sdk.LoggingLevel 
    import com.chartboost.sdk.Analytics
    import com.chartboost.sdk.events.CacheError 
    import com.chartboost.sdk.events.CacheEvent 
    import com.chartboost.sdk.events.ClickError 
    import com.chartboost.sdk.events.ClickEvent 
    import com.chartboost.sdk.events.DismissEvent
    import com.chartboost.sdk.events.ExpirationEvent
    import com.chartboost.sdk.events.ImpressionEvent
    import com.chartboost.sdk.events.ShowError
    import com.chartboost.sdk.events.ShowEvent
    
  • import com.chartboost.sdk.LoggingLevel;
    import com.chartboost.sdk.Analytics;