Home - cleveradssolutions/CAS-Android GitHub Wiki
The CAS.AI mediation is a feature lets you serve ads to your apps from multiple sources in one place. CAS SDK helps maximize your fill rate and increase your monetization by sending ad requests to multiple networks to ensure you find the best available network to serve ads.
Make sure that your app's build file uses the following values:
- Minimum SDK version of
23
or higher - Compile SDK version of
34
or higher
In your Gradle settings file (<project>/settings.gradle
), include the
following repositories
block so that Gradle can download the artifacts of ad networks:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
maven {
name = "MintegralAdsRepo"
url = "https://dl-maven-android.mintegral.com/repository/mbridge_android_sdk_oversea"
content { it.includeGroup("com.mbridge.msdk.oversea") }
}
maven {
name = "PangleAdsRepo"
url = "https://artifact.bytedance.com/repository/pangle"
content { it.includeGroup("com.pangle.global") }
}
maven {
name = "ChartboostAdsRepo"
url = "https://cboost.jfrog.io/artifactory/chartboost-ads/"
content { it.includeGroup("com.chartboost") }
}
maven {
name = "SuperAwesomeAdsRepo"
url = "https://aa-sdk.s3-eu-west-1.amazonaws.com/android_repo"
content { it.includeGroup("tv.superawesome.sdk.publisher") }
}
maven {
name = "YSONetworkRepo"
url = "https://ysonetwork.s3.eu-west-3.amazonaws.com/sdk/android"
content { it.includeGroup("com.ysocorp") }
}
maven {
name = "OguryAdsRepo"
url = "https://maven.ogury.co"
content {
it.includeGroup("co.ogury")
it.includeGroup("co.ogury.module")
}
}
}
}
Closed beta ads repos
Read more about Closed beta ads partners on Advanced integration page.
maven {
name = "MadexAdsRepo"
url = "https://sdkpkg.sspnet.tech"
content {
it.includeGroup("sspnet.tech")
it.includeGroup("sspnet.tech.adapters")
}
}
maven {
name = "SmaatoAdsRepo"
url = "https://s3.amazonaws.com/smaato-sdk-releases/"
content { it.includeGroup("com.smaato.android.sdk") }
}
If your project is using Gradle version below 7.0, the repositories
block should be added to the allprojects
block in the root-level build.gradle
file.
Enabling minifyEnabled
is a crucial step in optimizing your mobile application, especially when integrating ad mediation SDKs that augment your codebase's size. By leveraging code minification, you not only reduce the overall footprint of your app but also enhance its performance, security, and compatibility.
android {
buildTypes {
release {
minifyEnabled true
...
}
}
...
}
Note
The CAS SDK and adapters come bundled with the required ProGuard rules in the AARs. Therefore, you do not need to add any additional ProGuard rules to your project.
You can integrate CAS to your Android app using one of the following options:
- Option 1: Use the CAS Gradle plugin setup workflow (recommended, below).
- Option 2: Use the default Gradle setup (may require additional configuration).
The CAS SDK provide a Gradle Plugin to simplify and automate certain integration steps.
Our plugin will automatically add mediated network dependencies to your project, which you configure in an cas { }
block.
In your module (app-level) Gradle file (usually <project>/<app-module>/build.gradle
), add the CAS services plugin inside the plugins
block.
plugins {
id("com.android.application") // before CAS plugin
id("com.cleveradssolutions.gradle-plugin") version "4.0.2"
}
cas {
// Plugin configuration
}
How integrate CAS plugin in library module?
To integrating the plugin into the module id("com.android.library")
(library-level) you must define the cas.casId
property.
plugins {
id("com.android.library") // before CAS plugin
id("com.cleveradssolutions.gradle-plugin") version $casVersion
}
cas {
casId = "com.yourcompany.yourproject"
}
What is CAS ID?
In most cases, a casId
is the same as your application package name.
- A package name uniquely identifies your app on the device and in the Google Play Store.
- The package name value is case-sensitiv and is often referred to as an
APPLICATION_ID
. - Find your app's package name in your module (app-level) Gradle file, usually
app/build.gradle
(example package name:com.yourcompany.yourproject
).
How override CAS ID for Product Flavors in app module?
For the application module as a CAS Id will be selected the final applicationId
with all modifications.
android {
flavorDimensions.add("version")
productFlavors {
create("first") {
dimension = "version"
applicationIdSuffix = ".fisrt"
}
create("second") {
dimension = "version"
applicationIdSuffix = ".second"
}
}
}
casId
settings will be ignored when integrating into app-level modules, as the applicationId
(with all modifications for Build Variant and Product Flavor) will always be used as the CAS ID.
Note that you must register each final applicationId
as a separate CAS ID in platform.
How override CAS ID for Product Flavors in library module?
To integrate a CAS plugin into the id("com.android.library")
module (library level), you must define the cas.casId
property in the body of each product flavor.
cas {
casId = "com.yourcompany.yourproject"
addCasIdVariant("second", "com.yourcompany.yourproject.second")
}
android {
flavorDimensions.add("version")
productFlavors {
create("first") {
dimension = "version"
}
create("second") {
dimension = "version"
}
}
}
Note that you cannot use applicationId
because the library module does not have information about the application.
The Advertising ID is a unique, user-resettable, and user-deletable ID for advertising, provided by Google Play services.
cas {
useAdvertisingId = true
}
Note
An application must not use an advertising identifier if at least one of the following conditions is true:
- The app’s target audience includes only children, as defined in the Families Policy.
- The app is being built for devices that do not use Google Play Services (e.g. Amazon or Huawei devices).
CAS.AI SDK offers three integration paths. Choose one based on your app’s target audience. If you're unsure which solution best fits your application, please contact your account manager.
Recommended for most applications targeting a general or mixed audience. Includes a broad set of stable, high-performance networks:
Google Ads, Unity Ads, IronSource, LiftoffMonetize, InMobi, Yandex Ads, Mintegral, Pangle, Chartboost, DTExchange, AppLovin, AudienceNetwork, Bigo, CASExchange
cas {
includeOptimalAds = true
}
Required for applications directed exclusively at children, in accordance with the Google Play Families Policy. Networks included: Google Ads, Unity Ads, IronSource, LiftoffMonetize, InMobi, Chartboost, DTExchange, Kidoz, SuperAwesome
cas {
includeFamiliesAds = true
}
Advanced publishers who are familiar with ad network integrations can choose their own set of adapters. If you have any questions or need assistance, please contact your account manager.
Follow the instructions on the Mediated Networks page.
The following permissions are not required for our SDK or 3rd-party SDKs to function, but including them in your AndroidManifest.xml
may result in improved eCPM and user experience.
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
🔗 Next
Initialization