CAS.AI plugin for ReactNative

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:

  • For Android:
    • Minimum API level 24 or higher
  • For iOS:
    • Use Xcode 26.2 or higher
    • Minimum Target iOS version 13.0 or higher

Import CAS.AI Mobile Ads package

Include the CAS.AI plugin for ReactNative in your ReactNative project.

shell
npm install react-native-cas
Subscribe
Subscribe

Subscribe to receive notifications about CAS updates.

Now in your code, you can use:

ts
import * as CASModule from 'react-native-cas';

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.

Android setup

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.

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

cas {
  // Plugin configuration
}

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

iOS setup

React Native automatically adds an Xcode Build Phase to run the Ruby script for CAS project configuration.

To complete the setup, you need to add the <key>CASAIAppIdentifier</key> property with the <string>CASID</string> value to the <project>/ios/Runner/Info.plist.

KeyTypeValue
Information Property ListDictionary
▼ CASAIAppIdentifierStringCASID

The <project>/ios/Podfile is a specification that describes the dependencies of your iOS project. All CAS frameworks are hosted and distributed through their own source repository. Please add CAS source repository url to the beginning of the Podfile:

ruby
source 'https://github.com/CocoaPods/Specs.git'
source 'https://github.com/cleveradssolutions/CAS-Specs.git'

Mediation dependencies should be added to the target block, before the end line.

ruby
target 'Runner' do
    pod ...
    ...
end

Run pod update terminal command inside the ios directory after modifying the Podfile.

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

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.AI Plugin 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.