Android setup - cleveradssolutions/CAS-ReactNative GitHub Wiki

Before this steps, make sure that you done instructions from Project setup page


Add Maven repositories

Add the following repositories block to the settings.gradle file so that Gradle can download the artifacts of ad networks:

dependencyResolutionManagement {
  repositories {
    google()  
    mavenCentral()  
    maven {  
        name = "IronSourceAdsRepo"  
        url = "https://android-sdk.is.com/"  
        content { it.includeGroup("com.ironsource.sdk") }  
    }  
    maven {  
        name = "MintegralAdsRepo"  
        url = "https://dl-maven-android.mintegral.com/repository/mbridge_android_sdk_oversea"  
        content { it.includeGroup("com.mbridge.msdk.oversea") }  
    }  
    maven {  
        name = "PangleAdsRepo"  
        url = "https://artifact.bytedance.com/repository/pangle"  
        content { it.includeGroup("com.pangle.global") }  
    }  
    maven {  
        name = "SuperAwesomeAdsRepo"  
        url = "https://aa-sdk.s3-eu-west-1.amazonaws.com/android_repo"  
        content { it.includeGroup("tv.superawesome.sdk.publisher") }  
    }  
    maven {  
        name = "ChartboostAdsRepo"  
        url = "https://cboost.jfrog.io/artifactory/chartboost-ads/"  
        content { it.includeGroup("com.chartboost") }  
    }
    maven {  
        name = "MadexAdsRepo"  
        url = "https://sdkpkg.sspnet.tech"  
        content {  
            it.includeGroup("sspnet.tech")  
            it.includeGroup("sspnet.tech.adapters")  
        }  
    }
    maven {  
        name = "SmaatoAdsRepo"  
        url = "https://s3.amazonaws.com/smaato-sdk-releases/"  
        content { it.includeGroup("com.smaato.android.sdk") }  
    }  
  }
}

Add Ads Solution

Clever Ads Solutions provide ready-made solutions for you to choose from.
Such solutions do not require you to add each network adapter separately in dependencies.
Add one of the following dependencies of the standard Clever Ads Solution to your app-level build.gradle file.

  • An Optimal Ads Solutions contains a number of stable partner networks that are recommended for use in most applications.
implementation("com.cleveradssolutions:cas:3.6.0")
  • A Families Ads Solutions designed for applications tagged at a children's audience and fully compatible with the Google Play Families Policies.
implementation("com.cleveradssolutions:cas-families:3.6.0")
  • A Base SDK of CleverAdsSolutions only without dependencies on third party adapters. Using only the base SDK, you can add any adapters separately, read more about [Advanced integration].
implementation("com.cleveradssolutions:cas-sdk:3.6.0")

In the following table, you can see all the ad networks supported by Clever Ads Solutions. And a list of partners that are included in the Optimal and Families Ads solutions.

Network Optimal Families Notes
[Google Ads] :ballot_box_with_check: :ballot_box_with_check: [Notes][amNotes]
[Unity Ads] :ballot_box_with_check: :ballot_box_with_check: [Notes][unNotes]
[IronSource] :ballot_box_with_check: :ballot_box_with_check: [Notes][isNotes]
[LiftoffMonetize] :ballot_box_with_check: :ballot_box_with_check: [Notes][vunNotes]
[InMobi] :ballot_box_with_check: :ballot_box_with_check: [Notes][imNotes]
[Yandex Ads] :ballot_box_with_check: :heavy_minus_sign: [Notes][yaNotes]
[Mintegral] :ballot_box_with_check: :heavy_minus_sign: [Notes][minNotes]
[Pangle] :ballot_box_with_check: :heavy_minus_sign: :heavy_minus_sign:
[Chartboost] :ballot_box_with_check: :ballot_box_with_check: [Notes][cbNotes]
[DTExchange] :ballot_box_with_check: :ballot_box_with_check: [Notes][dtNotes]
[AppLovin] :ballot_box_with_check: :heavy_minus_sign: [Notes][alNotes]
[AudienceNetwork] :ballot_box_with_check: :heavy_minus_sign: [Notes][metaNotes]
[Bigo] :ballot_box_with_check: :heavy_minus_sign: [Notes][bigoNotes]
[Kidoz] :heavy_minus_sign: :ballot_box_with_check: [Notes][kzNotes]
[SuperAwesome] :heavy_minus_sign: :ballot_box_with_check: [Notes][saNotes]
[MyTarget] :heavy_minus_sign: :heavy_minus_sign: [Notes][mtNotes]

Please note that some ad networks require you to do Additional integration steps: Google AdMob, Meta AudienceNetwork, Yandex Mobile Ads.

Those ad networks that are not included in standard solutions can be added separately, read more about [Advanced integration].

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.

android {
    buildTypes {  
        release {  
            minifyEnabled true
            ...
        }  
    }
    ...
}

Google Advertising Identifier

[!NOTE]
If you are building for devices that do not utilize Google Play Services, skip this step. For example Amazon or Huawei.

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

Add the Play Services Ads identifier into the dependencies block to allow GAID information to be retrieved.

implementation("com.google.android.gms:play-services-ads-identifier:18.0.1")

Additionally, apps will need to declare a Google Play Services normal permission in the AndroidManifest.xml file as follows:

<uses-permission android:name="com.google.android.gms.permission.AD_ID"/>

Some SDKs, such as the Google Mobile Ads SDK may already declare this permission in the SDK’s library manifest.

If your app uses these SDKs as dependencies, the AD_ID permission from the SDK’s library manifest will be merged with your app’s main manifest by default, even if you don’t explicitly declare the permission in your app’s main manifest.

If the target audience for your app only includes children as described in the Families Policy, then you must prevent the permission from getting merged into your app by including the following element in your manifest. Just declare the remove node as follows:

<uses-permission android:name="com.google.android.gms.permission.AD_ID" tools:node="remove"/>

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"/>  
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>