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 23 or higher
  • For iOS:
    • Use Xcode 16.4 or higher
    • Minimum Target iOS version 13 or higher

Import CAS.AI Mobile Ads package

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

With npm command:

npm install react-native-cas

Subscribe

Subscribe to receive notifications about CAS updates.

Now in your code, you can use:

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 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.4.2"
}

cas {
  // Plugin configuration
}

Make sure to update the CAS Gradle plugin version whenever you update the CAS ReactNative package. The CASGradle plugin version matches the version of the CAS Android SDK. For detailed setup instructions, visit the CAS Android repository.

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.

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.

Check the details of the ad network adapters supported by CAS.AI Mediation in the Android repository and iOS repository tables.

Optimal Ads Solution

Recommended for most applications targeting a general or mixed audience. Includes a broad set of stable, high-performance networks.

cas {
    includeOptimalAds = true
}

Families Ads Solution

Required for applications directed exclusively at children, in accordance with the Google Play Families Policy and fully compatible with the Children’s Online Privacy Protection Act (COPPA).

cas {
    includeFamiliesAds = true
}

Choice networks

Advanced publishers familiar with ad network integrations can configure their own set of adapters. For detailed instructions on how to integrate specific adapters into your app, refer to the Android page and the iOS page.

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.

CAS Mediation allows you to easily enable or disable the use of the Advertising ID, depending on your app’s privacy requirements.

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