CAS.AI Android SDK

Integrating CAS SDK into an app is the first step toward displaying ads and earning revenue. Once you've integrated and initialized the SDK, you can choose an ad format and follow the steps to implement it.

App prerequisites

Make sure that your app's build file uses the following values:

  • Minimum SDK version of 24 or higher
  • Compile SDK version of 36 or higher
  • Kotlin version of 2.2.0 or higher

Add Maven repositories

In your Gradle settings file (<project>/settings.gradle.kts), include the following repositories block so that Gradle can download the artifacts of ad networks:

kotlin
dependencyResolutionManagement {
  repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
  repositories {
    google()
    mavenCentral()
    maven {
        name = "MintegralAdsRepo"  
        url = uri("https://dl-maven-android.mintegral.com/repository/mbridge_android_sdk_oversea")  
        content { includeGroup("com.mbridge.msdk.oversea") }  
    }  
    maven {
        name = "PangleAdsRepo"  
        url = uri("https://artifact.bytedance.com/repository/pangle")  
        content { includeGroup("com.pangle.global") }  
    }
    maven {
        name = "ChartboostAdsRepo"  
        url = uri("https://cboost.jfrog.io/artifactory/chartboost-ads/")  
        content {
          includeGroup("com.chartboost")
          includeGroup("com.iab.omid.library")
      }
    }
    maven {  
        name = "YSONetworkRepo"  
        url = uri("https://ysonetwork.s3.eu-west-3.amazonaws.com/sdk/android")  
        content { includeGroup("com.ysocorp") }  
    }
    maven {  
        name = "OguryAdsRepo"  
        url = uri("https://maven.ogury.co")  
        content {  
            includeGroup("co.ogury")  
            includeGroup("co.ogury.module")  
        }  
    }  
    maven {  
        name = "SmaatoAdsRepo"  
        url = uri("https://s3.amazonaws.com/smaato-sdk-releases/")  
        content { 
            includeGroup("com.smaato.android.sdk")
            includeGroup("com.verve")
        }  
    }  
    maven {
        name = "VerveAdsRepo"
        url = uri("https://verve.jfrog.io/artifactory/verve-gradle-release")
        content {
            includeGroup("net.pubnative")
            includeGroup("com.verve")
            includeGroup("com.smaato.android.sdk")
        }
    }
    maven {
        name = "SuperAwesomeRepo"
        url = uri("https://aa-sdk.s3-eu-west-1.amazonaws.com/android_repo/")
        content { includeGroup("tv.superawesome.sdk.publisher") }
    }
  }
}

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.

Integration options

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).

Add CAS Gradle Plugin

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.

groovy
plugins {
    id("com.android.application") // before CAS plugin
    id("com.cleveradssolutions.gradle-plugin") version "4.8.0"
}

cas {
    // Plugin configuration
}
Subscribe
Subscribe

Subscribe to receive notifications about CAS updates.

Choose Mediated Networks

Choose an integration path 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.

groovy
cas {
    includeOptimalAds = true
}

Networks included: Google Ads, Unity Ads, IronSource, LiftoffMonetize, InMobi, Yango Ads, Mintegral, Pangle, DTExchange, AppLovin, AudienceNetwork, Bigo, CASExchange, Monetrix, Maticoo, YSO Netowrk

Google Advertising Identifier

The Advertising ID is a unique, user-resettable, and user-deletable ID for advertising, provided by Google Play services.

groovy
cas {
    useAdvertisingId = true
}

Enable Code minification

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.

kotlin
android {
    buildTypes {  
        release {  
            isMinifyEnabled = true
            proguardFiles(...)
        }  
    }
    ...
}

Optional permissions

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.

xml
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>