CAS.AI plugin for Flutter
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.
Prerequisites
Make sure that your app's build file uses the following values:
- Use Flutter
3.0.0or higher - For Android:
- Minimum API level
23or higher
- Minimum API level
- For iOS:
- Use Xcode
26.0or higher - Minimum Target iOS version
13.0or higher
- Use Xcode
Import CAS.AI Mobile Ads package
Include the CAS.AI plugin for Flutter in your Flutter project.
With Flutter command:
flutter pub add clever_ads_solutions
Subscribe
Subscribe to receive notifications about CAS updates.
Now in your Dart code, you can use:
import 'package:clever_ads_solutions/clever_ads_solutions.dart';
Platform specific setup
To monetize your app using CAS.AI mediation, in addition to importing the package, you need to configure your Android and iOS projects by using the CAS Gradle plugin for Android and a Ruby CAS script for iOS.
The CAS Android 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 Android app Gradle file (usually <project>/android/app/build.gradle), add the com.cleveradssolutions.gradle-plugin inside the plugins block.
plugins {
id("com.android.application") // before CAS plugin
id("com.cleveradssolutions.gradle-plugin") version "4.7.4"
}
cas {
// Plugin configuration
}
Make sure to update the CAS Gradle plugin version whenever you update the CAS Flutter package. The CASGradle plugin version matches the version of the CAS Android SDK. For detailed setup instructions, visit the CAS Android repository.
Choose Mediated Networks
CAS.AI is a mediation SDK with no built-in live ad inventory. At least one ad network adapter or solution must be integrated before publishing to display ads and generate revenue.
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.
During development, you can test ad formats using Test Ads without adding any ad network SDKs.
Check the details of the ad network adapters supported by CAS.AI Mediation in the Android repository and iOS repository tables.
Recommended for most applications targeting a general or mixed audience. Includes a broad set of stable, high-performance networks.
// <project>/android/app/build.gradle
cas {
includeOptimalAds = true
}
Advertising Identifier
CAS Mediation uses the Google Advertising ID and Apple Identifier for Advertisers (IDFA) to deliver personalized and more relevant ads to each user.
To enable the use of the Advertising ID in your app, you need to complete the following setup steps.