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 23 or higher
  • Compile SDK version of 35 or higher

Maven repositories

Some advertising SDKs are published in their own Maven repositories. To allow Gradle to download the required artifacts, you need to add the advertising Maven repositories to your Gradle settings file (<project>/settings.gradle.kts).

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") }  
    }
    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 = "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).

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.

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

cas {
    // Plugin configuration
}

Subscribe

Subscribe to receive notifications about CAS updates.

Mediated Networks

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.

Optimal Ads Solution

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, Yango Ads, Mintegral, Pangle, Chartboost, DTExchange, AppLovin, AudienceNetwork, Bigo, CASExchange

cas {
    includeOptimalAds = true
}

Families Ads Solution

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

cas {
    includeFamiliesAds = true
}

Choice networks

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.

Google Advertising Identifier

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

cas {
    useAdvertisingId = true
}

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

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.

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

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.

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.

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