We support Android Operating Systems Version 4.2 (API level 17) and up.
As of SDK 18.0.0, AdMob migrated from Android Support Libraries to Jetpack (AndroidX) Libraries. Refer to the Google Play services release notes for more information.
Due to this, we working with the AdMob adapter it’s required that your project migrates from Android Support Libraries to Jetpack Libraries (Android X) if you are using any. Please refer to Migrating to AndroidX for more information.
In case you can not migrate the project using this tool, you can use the following flags in gradle.properties, to build your project using AndroidX.
- android.useAndroidX = true
- android.enableJetifier = true
Google is focused on providing a great experience for families on Google Play and wants to help make sure that any ads served to children are appropriate.
More about Families Ads Program.
If your app's target audience includes children and serves ads using an ad Clever General Ads Solutions only.
- Add the CAS SDK to Your Project
- Gradle settings
- Add mediation SDK
- Add Cross Promotion SDK
- Update AndroidManifest
- Privacy Laws
 6.1. GDPR Managing Consent
 6.2. CCPA Compliance
 6.3. COPPA and EEA Compliance
- Verify Your Integration
- Initialize the SDK
- Implement our Ad Units
 9.1. Banner Ad
 9.2. Ad Size
 9.3. Ad Callback
 9.4. Check Ad Availability
 9.5. Show fullscreen Ad
- Adding App-ads.txt file of our partners
- Mediation partners
- Support
Add one of the following sdk to the dependencies section for your ad audience.
- Families Ads Program solutions and skip Step 3
dependencies {
    implementation 'com.cleversolutions.ads:cas-sdk-general:1.4.5' 
}- Teen audiences solutions with additional mediation networks, not for Families Ads Program, and skip Step 3
dependencies {
    implementation 'com.cleversolutions.ads:cas-sdk-teen:1.4.5'
}- CAS without mediation dependencies. Follow Step 3 to integrate mediation SDK.
dependencies {
    implementation 'com.cleversolutions.ads:cas-sdk:1.4.5' 
}- Download the latest release binaries from GitHub, specifically CleverAdsSolutions.aar
- Create or open your existing Android project in Android Studio.
- Add new module and import CleverAdsSolutions.aar. Name the module "CleverAdsSolutions" for example.
- Open Module Settings for the app and add "CleverAdsSolutions" module as a dependency.
- Add following dependencies of support libraries:
dependencies {
      ...
      implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
      implementation 'com.google.code.gson:gson:2.8.6'
      implementation 'androidx.appcompat:appcompat:1.1.0'
      implementation 'androidx.multidex:multidex:2.0.1'
      implementation 'androidx.core:core:1.1.0'
      implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.0.0'
      implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
      implementation 'androidx.legacy:legacy-support-v4:1.0.0'
      implementation 'androidx.recyclerview:recyclerview:1.0.0'
      implementation 'com.squareup.picasso:picasso:2.71828'
      implementation 'androidx.browser:browser:1.2.0'
      implementation 'com.google.android.gms:play-services-ads-identifier:17.0.0'
      implementation 'com.google.android.gms:play-services-basement:17.3.0'
      implementation 'com.google.android.gms:play-services-base:17.3.0'
      implementation 'org.greenrobot:eventbus:3.1.1'
}Add the following to your app’s build.gradle file inside repositories section:
repositories {
      google()
      jcenter()
      maven { url "https://dl.bintray.com/cleveradssolutions/CAS-Android" }
      maven { url "https://adcolony.bintray.com/AdColony" }
      maven { url "https://dl.bintray.com/ironsource-mobile/android-sdk" }
      maven { url "https://maven.google.com" }
      maven { url "https://chartboostmobile.bintray.com/Chartboost" }
      maven { url 'http://dl.bintray.com/gabrielcoman/maven' }
      maven { url "http://dl.bintray.com/superawesome/SuperAwesomeSDK" }
      ...
}At times, including the CAS SDK may cause the 64K limit on methods that can be packaged in an Android dex file to be breached. This can happen if, for example, your app packs a lot of features for your users and includes substantive code to realize this.
If this happens, you can use the multidex support library to enable building your app correctly. To do this:
- Modify the defaultConfig to mark your application as multidex enabled:
defaultConfig {
   ...
   multiDexEnabled true // add this to enable multi-dex
}- Add the following line to the dependencies element in your application build script.
dependencies {
    // AndroidX dependency
    implementation 'androidx.multidex:multidex:2.0.1'
    // OR Legacy Support dependency
    implementation 'com.android.support:multidex:1.0.3'
}Our SDK requires for correct operation to determine the Java version in Gradle. Add the following line to the android element in your application module’s build script.
android{
    ...
    compileOptions {
        sourceCompatibility = JavaVersion.VERSION_1_8
        targetCompatibility = JavaVersion.VERSION_1_8
    }
}The CAS Mediation platform supports interstitial and video ads from 12 leading ad networks, equipped with smart loading, ad placement technology and ad delivery optimization. Our Mediation solution is a new monetization tool that enhances user experience, offers better control on ad performance and significantly increases revenue!
Skip Step 3 if use gradle integrate cas-sdk-general or cas-sdk-teen
Add following dependencies of Mediation Ad Network SDK:
dependencies {
      ...
      implementation 'com.google.android.gms:play-services-ads:19.3.0'
      implementation 'com.kidoz.sdk:KidozSDK:0.8.8.8'
      implementation 'com.vungle:publisher-sdk-android:6.7.1'
      implementation 'com.adcolony:sdk:4.2.2'
      implementation 'com.startapp:inapp-sdk:4.6.1'
      implementation 'com.ironsource.sdk:mediationsdk:7.0.0'
      implementation 'com.applovin:applovin-sdk:9.13.+'
      implementation 'com.inmobi.monetization:inmobi-ads:9.0.7'
      implementation 'com.chartboost:chartboost-sdk:8.1.0'
}If your app's target audience includes children then you can integrate an additional SuperAvesome network:
dependencies {
      ...
      implementation 'tv.superawesome.sdk.publisher:superawesome:7.2.13'
}If your app's target audience not includes children then you can integrate an additional Facebook Audience and Yandex networks:
dependencies {
      ...
      implementation 'com.cleversolutions.ads:mediation-teen:1.4.5'
      implementation 'com.facebook.android:audience-network-sdk:5.11.0'
      implementation 'com.yandex.android:mobileads:2.170'
      implementation 'com.yandex.android:mobmetricalib:3.13.3'
}Cross promotion is an app marketing strategy in which app developers promote one of their titles on another one of their titles. Cross promoting is especially effective for developers with large portfolios of games as a means to move users across titles and use the opportunity to scale each of their apps. This is most commonly used by hyper-casual publishers who have relatively low retention, and use cross promotion to keep users within their app portfolio.
Start your cross promotion campaign with CAS here.
dependencies {
      ...
      implementation 'com.cleversolutions.ads:cas-promo:1.4.5'
}Add the following permissions to your AndroidManifest.xml file inside the manifest tag but outside the tag:
<manifest>
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
   
    <!--Optional Permissions-->
    
    <!--This permission is used for certain ads that vibrate during play. 
    This is a normal level permission, so this permission just needs to be defined in the manifest to enable this ad feature.-->
    <uses-permission android:name="android.permission.VIBRATE" />
    
    <!--This permission is used for certain ads that allow the user to save a screenshot to their phone. 
    Note that with this permission on devices running Android 6.0 (API 23) or higher, 
    this permission must be requested from the user. 
    See Requesting Permissions for more details. https://developer.android.com/training/permissions/requesting -->
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    
    <!--This permission is not a mandatory permission, however, including it will enable accurate ad targeting-->
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    ...
</manifest>Follow the link to get your Admob App ID.
Add your AdMob App ID to your app's AndroidManifest.xml file by adding a tag with name com.google.android.gms.ads.APPLICATION_ID, as shown below.
For android:value insert your own AdMob App ID in quotes, as shown below.
<manifest>
  <application>
    ...
    <!-- Sample AdMob App ID: ca-app-pub-3940256099942544~3347511713 -->
    <meta-data
        android:name="com.google.android.gms.ads.APPLICATION_ID"
        android:value="ca-app-pub-xxxxxxxxxxxxxxxx~yyyyyyyyyy"/>
  </application>
</manifest>Follow the link to download a cas_settings.json file.
Drop the cas_settings.json into the src/res/raw/ folder in your project.
This documentation is provided for compliance with various privacy laws. If you are collecting consent from your users, you can make use of APIs discussed below to inform CAS and all downstream consumers of this information.
A detailed article on the use of user data can be found in the Privacy Policy.
This documentation is provided for compliance with the European Union's General Data Protection Regulation (GDPR). In order to pass GDPR consent from your users, you should make use of the APIs and methods discussed below to inform CAS and all downstream consumers of this information.
Passing Consent to CAS API, use this functions:
If the user provided consent, please set the following flag to "true":
CAS.getSettings().setConsent(true);If the user did not consent, please set the following flag to "false":
CAS.getSettings().setConsent(false);This documentation is provided for compliance with the California Consumer Privacy Act (CCPA). In order to pass CCPA opt-outs from your users, you should make use of the APIs discussed below to inform CAS and all downstream consumers of this information.
Passing Opt-outs In the Android SDK v1.4, we added privacy methods to our AdsSettings API for additional support in CCPA compliance. To successfully pass us an opt-out signal, the publisher will need to provide CAS a signal to indicate whether CCPA legislation is applicable to the user in addition to the actual consent value.
A value of "false" implies the user has not opted-out to the sale of their data, as defined by the CCPA, and CAS should continue with our standard processing of user information.
CAS.getSettings().setDoNotSell(false);A value of "true" means the user has opted-out to the sale of their data.
CAS.getSettings().setDoNotSell(true);This documentation is provided for additional compliance with the Children’s Online Privacy Protection Act (COPPA). Publishers may designate all inventory within their applications as being child-directed or as COPPA-applicable though our UI. Publishers who have knowledge of specific individuals as being COPPA-applicable should make use of the API discussed below to inform CAS and all downstream consumers of this information.
You can mark your ad requests to receive treatment for users in the European Economic Area (EEA) under the age of consent. This feature is designed to help facilitate compliance with the General Data Protection Regulation (GDPR). Note that you may have other legal obligations under GDPR. Please review the European Union’s guidance and consult with your own legal counsel. Please remember that CAS tools are designed to facilitate compliance and do not relieve any particular publisher of its obligations under the law.
Call "true" indicate that you want your content treated as child-directed for purposes of COPPA or receive treatment for users in the European Economic Area (EEA) under the age of consent.
CAS.getSettings().isTaggedForChildren(true);Call "false" to indicate that you don't want your content treated as child-directed for purposes of COPPA or not receive treatment for users in the European Economic Area (EEA) under the age of consent.
CAS.getSettings().isTaggedForChildren(false);We recommend to set Privacy API before initializing CAS SDK.
The CAS SDK provides an easy way to verify that you’ve successfully integrated the ironSource SDK and any additional adapters; it also makes sure all required dependencies and frameworks were added for the various mediated ad networks.
After you have finished your integration, call the following static method and confirm that all networks you have implemented are marked as VERIFIED:
CAS.validateIntegration(activity, appContentRating);Find log information by tag: CASIntegrationHelper
Once you’ve successfully verified your integration, please remember to remove the integration helper from your code.
NOT. The Integration Helper tool reviews everything, including ad networks you may have intentionally chosen NOT to include in your application. These will appear as MISSING and there is no reason for concern. In the case the ad network’s integration has not been completed successfully, it will be marked as NOT VERIFIED.
You can access to SDK from any thread.
Import the CAS SDK
import com.cleversolutions.ads.*
import com.cleversolutions.ads.android.CASConfigure Ads Settings singleton instance for configure all mediation managers:
CAS.getSettings().setConsent(userConsent);
CAS.getSettings().setNativeDebug(true);
// .. other settingsSelect the desired load manager mode:
| Mode | Load* | Impact on App performance | Memory usage | Actual ads* | 
|---|---|---|---|---|
| FastestRequests | Auto | Very high | High | Most relevant | 
| FastRequests | Auto | High | Balance | High relevance | 
| Optimal(Default) | Auto | Balance | Balance | Balance | 
| HighPerformance | Auto | Low | Low | Possible loss | 
| HighestPerformance | Auto | Very low | Low | Possible loss | 
| Manual | Manual | Very low | Low | Depends on the frequency | 
CAS.getSettings().setLoadingMode(LoadingManagerMode.Optimal);Actual ads* - Potential increase in revenue by increasing the frequency of ad requests. At the same time, it greatly affects the performance of the application.
Load*
Auto control load mediation ads starts immediately after initialization and will prepare displays automatically.
Manual control loading mediation ads requires manual preparation of advertising content for display. Use ad loading methods before trying to show:MediationManager.loadInterstitial(), MediationManager.loadRewardedVideo(), CASBannerView.loadNextAd()
Initialize MediationManager instance:
import com.cleversolutions.ads.android.CAS;
...
class YourActivity extends Activity{
  MediationManager manager;
  void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      // Configure AdsSettings before initialize
      manager = CAS.initialize(
            // Root Activity. Warning: this activity can be memorized by some media networks.
            this,
            // Manager identifier. Can be NULL when matches the app package  
            own_identifier, 
            // Optional set active Ad Types: 'AdTypeFlags.Banner | AdTypeFlags.Interstitial' for example.  
            AdTypeFlags.Everything, 
            // Optional Demo ad fill only. Set FALSE for release!  
            true, 
            // Optional subscribe to initialization done  
            new OnInitializationListener(){  
                void onInitialization(boolean success, String error){  
                    // CAS manager initialization done  
                }  
            }  
      );  
  }  
}CAS.initialize can be called for different identifiers to create different managers.
Optional. Subscribe listener to Ad Loading response:
manager.getOnAdLoadEvent().add(new AdLoadCallback(){
    @AnyThread
    override void onAdFailedToLoad(AdType type, String error){
        // Callback on AdType failed to load and cant be shown.
    }
    
    @AnyThread
    override void onAdLoaded(AdType type){
        // Callback on AdType loaded and ready to shown.
    }
})The first step toward displaying a banner is to place CASBannerView in the layout for the Activity or Fragment in which you'd like to display it. The easiest way to do this is to add one to the corresponding XML layout file. Here's an example that shows an activity's CASBannerView:
# main_activity.xml
...
  <com.cleversolutions.ads.android.CASBannerView 
      xmlns:ads="http://schemas.android.com/apk/res-auto"
      android:id="@+id/bannerView"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:gravity="center"
      ads:bannerSize="Standard320x50"/>
...Note the following required attributes:
ads:bannerSize - Set this to the ad size you'd like to use. If you don't want to use the standard size defined by the constant, you can set a custom size instead. See the banner size section below for details.
CASBannerView bannerView = new CASBannerView(this, manager);
// Select banner Size
bannerView.setSize(AdSize.Standard320x50);
// OR same
// manager.bannerSize = AdSize.Standard320x50
bannerView.setPosition(AdPosition.Center);
bannerView.setListener(new AdCallback(){...});
// Add bannerView to your view hierarchy.
parentView.addView(bannerView);
// OR
activity.addContentView(bannerView, new LayoutParams(...));Manual load manager mode require call loadNextAd() after create CASBannerView and change banner size.
You can use loadNextAd() for cancel current impression and load next ad.
bannerView.loadNextAd();| Size in dp (WxH) | Description | Availability | AdSize constant | 
|---|---|---|---|
| 320x50 | Standard Banner | Phones and Tablets | BANNER | 
| 728x90 | IAB Leaderboard | Tablets | LEADERBOARD | 
| 300x250 | IAB Medium Rectangle | Phones and Tablets | MEDIUM_RECTANGLE | 
Adaptive banners are the next generation of responsive ads, maximizing performance by optimizing ad size for each device.
To pick the best ad size, adaptive banners use fixed aspect ratios instead of fixed heights. This results in banner ads that occupy a more consistent portion of the screen across devices and provide opportunities for improved performance. You can read more in this article.
Use the appropriate static methods on the ad size class, such as AdSize.getAdaptiveBanner(context, maxWidthDPI) to get an adaptive AdSize object.
// Get adaptive size in container view group:
adaptiveSize = AdSize.getAdaptiveBanner(viewGroup);
// Get adaptive size in full screen width:
adaptiveSize = AdSize.getAdaptiveBannerInScreen(context);
// Get adaptive size with width parameter:
adaptiveSize = AdSize.getAdaptiveBanner(context, maxWidthDPI);
// After create Apadtive size need call MediationManager:
manager.setBannerSize(adaptiveSize);
// OR same
bannerView.setSize(adaptiveSize);Typically, Smart Banners on phones have a BANNER size. Or on tablets a LEADERBOARD size.
Use the static method in the AdSize.getAdaptiveBanner (context, maxWidthDPI) ad size class to get the smart AdSize object.
smartSize = AdSize.getSmartBanner(context);
// After create Smart size need call MediationManager:
manager.setBannerSize(smartSize);
// OR same
bannerView.setSize(smartSize);An ad unit’s automatic refresh rate determines how often a new ad request is generated for that ad unit.
We recommend using 30 seconds (Default) refresh rate.
You may also set a custom refresh rate of 5-360 seconds.
This setting is available for change through the web application settings.
You can specify refresh rate before initialization to allow overrides settings by the web interface for a given session.
CAS.getSettings().setBannerRefreshInterval(interval);
manager = CAS.initialize(...);Or after initialization to override the web application settings for a given session.
manager = CAS.initialize(..., new OnInitializationListener(){  
    void onInitialization(boolean success, String error){  
        // CAS manager initialization done  
        CAS.getSettings().setBannerRefreshInterval(interval);
    }  
} );// Executed when the ad is displayed.
// @param ad Information of displayed ad.
@MainThread void onShown(com.cleversolutions.ads.AdStatusHandler ad);
// Executed when the ad is failed to display.
// The Banner may automatically appear when the Ad is ready again.
// This will trigger the [onShown] callback again.
@MainThread void onShowFailed(String message);
// Executed when the user clicks on an ad.
@AnyThread void onClicked();
// Executed when the Ad is completed.
// Banner Ad does not use this callback.
@AnyThread void onComplete();
// Executed when the ad is closed.
// The Banner Ad cannot be displayed automatically after this callback for the current view.
// If you decide to show the Banner Ad on this view then you need refresh view visibility.
@AnyThread void onClosed();You can ask for the ad availability directly by calling the following function:
manager.isAdReady(AdType.Interstitial); //Check ready any AdTypeManual load manager mode require call manager.loadInterstitial() and manager.loadRewardedVideo()  before try show ad.
You will also need to load new ad after the ad closed.
manager.loadInterstitial();
manager.loadRewardedVideo();Invoke the following method to serve an selected ad to your users:
manager.show(
        // Ad type Interstitial or Rewarded
        AdType.Interstitial, 
        // Optional. AdCallback implementation
        new AdCallback(){...}
      );You can limit the posting of an interstitial ad to a period of time in seconds after the ad is closed, during which display attempts will fail.
This setting is available for change through the web application settings.  Unlimited by default (0 seconds).
You can specify minimal interval before initialization to allow overrides settings by the web interface for a given session.
CAS.getSettings().setInterstitialInterval(interval);
manager = CAS.initialize(...);Or after initialization to override the web application settings for a given session.
manager = CAS.initialize(..., new OnInitializationListener(){  
    void onInitialization(boolean success, String error){  
        // CAS manager initialization done  
        CAS.getSettings().setInterstitialInterval(interval);
    }  
} );You can also restart the countdown interval until the next successful ad shown. For example, after closing Rewarded Video Ad.
CAS.getSettings().restartInterstitialInterval();Last year, the ad tech industry struck back at one of its most elusive problems — widespread domain spoofing that let unauthorized developers sell premium inventory they didn’t actually have. The solution? Over two million developers adopted ads.txt — a simple-text public record of Authorized Digital Sellers for a particular publisher’s inventory — to make sure they didn’t lose money from DSPs and programmatic buyers who avoid noncompliant publishers. Thanks to buyers’ ability to crawl ads.txt and verify seller authenticity, this has quickly become a standard for protecting brands. Ad fraud reduced by 11% in 2019 due to these efforts and publisher’s ability to implement more fraud prevention techniques.
The time has come for ads.text to evolve in-app. The introduction of apps-ads.txt is an important method for mobile app devs to similarly eliminate fraud and improve transparency.
Like ads.txt, apps-ads.txt is a text file that app devs upload to their publisher website. It lists all ad sources authorized to sell that publisher’s inventory. The IAB created a system that allows buyers to distinguish the authorized sellers for specific in-app inventory, weeding out the undesirables.
A DSP wanting to bid on an app’s inventory crawls the app-ads.txt file on a developer’s website to verify which ad sources are authorized to sell that app’s inventory. The DSP will only accept bid requests from ad sources listed on the file and authorized by the app developer.
Authorized in-app inventory. An ever-increasing amount of brands are looking to advertise in-app today. Brand buyers now rely on an adherence to app-ads.txt to make sure they don’t buy unauthorized inventory from app developers and negatively impact campaign performance. Developers who don’t implement app-ads.txt can be removed from any brand buyer’s target media list. That’s why joining the app-ads.txt movement is crucial for publishers to maintain their revenue.
Ad fraud prevention. App-ads.txt blocks unauthorized developers who impersonate legitimate apps and mislead DSPs into spending brand budgets on fake inventory. With fraud instances minimized, authentic developers can retain more of the ad revenue from inventory genuinely targeted to their app.
You must list your Developer Website URL in the GooglePlay and iTunes app stores. There must be a valid developer website URL in all app stores hosting your apps.
Make sure that your publisher website URL (not app specific URL) is added in your app store listings. Advertising platforms will use this site to verify the app-ads.txt file.
We have made it easier for you to include CAS list of entries so that don’t have to construct it on your own. Please copy and paste the following text block and include in your txt file along with entries you may have from your other monetization partners:
App-ads.txt Updated July 30, 2020.
- Admob
- AppLovin
- Chartboost
- KIDOZ
- UnityAds
- Vungle
- AdColony
- StartApp
- SuperAwesome
- IronSource
- InMobi
- Facebook Audience
- Yandex Ad
Site: https://cleveradssolutions.com
Technical support: Max
Skype: m.shevchenko_15
Network support: Vitaly
Skype: zanzavital