Get Started on Android
Before You Begin
- Sign up for a Chartboost Mediation (formerly Helium) Account.
- Add apps to the Mediation Dashboard. (See Import Apps)
- Set up Ad Placements in the Mediation Dashboard. (See Manage Placements)
Minimum Supported Development Tools
Software | Version |
---|---|
Android Studio | 2020.3.1+ |
Android OS | 5.0+ (API level 21) |
Add the Mediation SDK to your project
For build.gradle
repositories {
maven {
name "Helium's maven repo"
url "https://cboost.jfrog.io/artifactory/helium"
}
}
dependencies {
implementation 'com.chartboost:helium:3.3.1'
}
Add 3rd-Party Dependencies
implementation "org.greenrobot:eventbus:3.3.1"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.6.10"
implementation "org.jetbrains.kotlin:kotlin-reflect:1.6.10"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.0"
Add Google Play Services
Add the Google Play Services Library as a dependency of your project. For detailed instructions, reference the official integration instructions for Google Play Services.
As opposed to referencing the entire Google Play Services package, you only need play-services-base
, play-services-ads-identifier
, and play-services-appset
:
implementation 'com.google.android.gms:play-services-base:18.0.1'
implementation 'com.google.android.gms:play-services-ads-identifier:18.0.1'
implementation 'com.google.android.gms:play-services-appset:16.0.2'
Activity Lifecycles
override fun onBackPressed() {
// If an interstitial is on screen, pass the event to the ad network SDK to close it.
if (HeliumSdk.onBackPressed()) {
return
} else {
super.onBackPressed()
}
}
@Override
public void onBackPressed() {
// If an interstitial is on screen, pass the event to the ad network SDK to close it.
if (HeliumSdk.onBackPressed())
return;
else
super.onBackPressed();
}
OPTIONAL STEP: Download the Mediation Android Sample App
The Mediation Android Sample App is no longer distributed via a package and has been moved to a public GitHub repo.
Updated 4 days ago