Interstitial Ads - cleveradssolutions/CAS-Android GitHub Wiki

:zap: Before you start
Make sure you have correctly Initialize CAS.

Interstitial ads are full-screen ads that cover the interface of their host app. They're typically displayed at natural transition points in the flow of an app, such as between activities or during the pause between levels in a game. When an app shows an interstitial ad, the user has the choice to either tap on the ad and continue to its destination or close it and return to the app.

This guide explains how to integrate interstitial ads into an Android app.

Load an ad

By default, the auto-load ads mode is used and a load method does not need to be called. Call manual load ad before each show if you use LoadingManagerMode.Manual only.

Manual load Interstitial ads.


You can get a callback for the successful loading of the ads:

manager.getOnAdLoadEvent().add(new AdLoadCallback() {  
    public void onAdLoaded(@NonNull AdType type) {  
        if (type == AdType.Interstitial) {  
            // Interstitial loaded  
    public void onAdFailedToLoad(@NonNull AdType type, @Nullable String error) {  
        if (type == AdType.Interstitial) {  
            // Interstitial failed to load with error  

Check the ad availability

You can ask for the ad availability directly by calling the following function:

boolean adLoaded = manager.isInterstitialReady();

Ad Callback

The AdCallback handles events related to displaying your Interstitial ad.

AdCallback callback = new AdCallback() {  
    public void onShown(@NonNull AdStatusHandler ad) {  
        // Called when ad is shown.
    public void onShowFailed(@NonNull String message) {  
        // Called when ad fails to show. 
    public void onClicked() {  
        // Called when a click is recorded for an ad.  
    public void onComplete() {  
        // Called when ad is completed
    public void onClosed() {  
        // Called when ad is dismissed

When an error occurs during ad impression, executed the onShowFailed() only.
onClosed() in this case will not be executed, since the impression is not considered successful.

Read more about event onShown with Impression level data.

Show the ad

The showInterstitial() method requires Activity and AdCallback instances as arguments.

  • activity The Activity instance should be the activity from which the interstitial ad is presented.
  • callback The callback for Interstitial ad events.
manager.showInterstitial(activity, callback);

Minimum interval between impressions

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. Unlimited by default 0 seconds.
That the interval starts only after the Interstitial Ad closes AdCallback.onClosed(). During interval after ad closed, display attempts will fire event AdCallback.onShowFailed() with AdError.CODE_INTERVAL_NOT_YET_PASSED.

You can specify minimal interval before initialization to allow overrides settings by the web interface for a given session.


If you need to wait for a period of time after the start of the app or after showing a Rewarded Ad until next Interstitial Ad impression then call the following method:


We recommend define the interstitial ad impression interval once before mediation manager is initialized to be able to override the value remotely via the web interface.

Muted Ad sounds

Indicates if the application’s audio is muted. Affects initial mute state for all ads.
Use this method only if your application has its own volume controls.


Some best practices

  • Consider whether interstitial ads are the right type of ad for your app.
    Interstitial ads work best in apps with natural transition points. The conclusion of a task within an app, like sharing an image or completing a game level, creates such a point. Because the user is expecting a break in the action, it's easy to present an interstitial ad without disrupting their experience. Make sure you consider at which points in your app's workflow you'll display interstitial ads and how the user is likely to respond.
  • Remember to pause the action when displaying an interstitial ad.
    There are a number of different types of interstitial ads: text, image, video, and more. It's important to make sure that when your app displays an interstitial ad, it also suspends its use of some resources to allow the ad to take advantage of them. For example, when you make the call to display an interstitial ad, be sure to pause any audio output being produced by your app.
  • Allow for adequate loading time.
    Just as it's important to make sure you display interstitial ads at an appropriate time, it's also important to make sure the user doesn't have to wait for them to load. Loading the ad in advance by calling loadInterstitial() before you intend to call showInterstitial() can ensure that your app has a fully loaded interstitial ad at the ready when the time comes to display one.
  • Don't flood the user with ads.
    While increasing the frequency of interstitial ads in your app might seem like a great way to increase revenue, it can also degrade the user experience and lower clickthrough rates. Make sure that users aren't so frequently interrupted that they're no longer able to enjoy the use of your app.

🔗 Done! What’s Next?