Skip to main content
danger
Android SDK 3.0.2 is outdated. The most recent stable version is here.
Version: 3.0.2

Interstitial

Interstitial ads are full-screen advertisements.

You can use our demo interstitial app as a reference project.

Demo App

Display

To display interstitial, you need to call the following code in the activity:

Appodeal.show(this, Appodeal.INTERSTITIAL)
SDK can't show ads without a network connection!

The method returns a boolean value indicating whether the call to the show method was passed to the appropriate SDK.

Check If Ad Is Loaded

You can check if the ad has been uploaded before showing it. This method returns a boolean value indicating whether the intermediate element has been loaded or not.

Appodeal.isLoaded(Appodeal.INTERSTITIAL)

We recommend you always check whether an ad is available before trying to show it.

if (Appodeal.isLoaded(Appodeal.INTERSTITIAL)) {
Appodeal.show(this, Appodeal.INTERSTITIAL)
}

Placements

Appodeal SDK allows you to tag each impression with different placement. To be able to use placements, you need to create them in Appodeal Dashboard. Read more about placements.

Appodeal.show(this, Appodeal.INTERSTITIAL, "yourPlacementName")

If the loaded ad can't be shown in a specific placement, nothing will be shown. If auto caching is enabled, the SDK will start to cache another ad, which can affect display rate. To save the loaded ad for future use (for instance, for another placement), check if the ad can be shown before calling show method:

if (Appodeal.canShow(Appodeal.INTERSTITIAL, "yourPlacementName")) {
Appodeal.show(this, Appodeal.INTERSTITIAL, "yourPlacementName")
}

You can configure your impression logic for each placement.

If you have no placements or call Appodeal.show with a placement that does not exist, the impression will be tagged with default placement with corresponding settings applied.

Important!

Placement settings affect ONLY ad presentation, not loading or caching.

Callbacks

Appodeal.setInterstitialCallbacks(object : InterstitialCallbacks {
override fun onInterstitialLoaded(isPrecache: Boolean) {
// Called when interstitial is loaded
}
override fun onInterstitialFailedToLoad() {
// Called when interstitial failed to load
}
override fun onInterstitialShown() {
// Called when interstitial is shown
}
override fun onInterstitialShowFailed() {
// Called when interstitial show failed
}
override fun onInterstitialClicked() {
// Called when interstitial is clicked
}
override fun onInterstitialClosed() {
// Called when interstitial is closed
}
override fun onInterstitialExpired() {
// Called when interstitial is expired
}
})
info

All callbacks are called on the main thread.

Manual Caching

By default, auto caching is enabled: Appodeal SDK starts to load Interstitial right after the initialization method is called.

The next interstitial ad starts to load after the previous one has been closed.

To disable automatic caching for interstitials, use the code below before SDK initialization:

Appodeal.setAutoCache(Appodeal.INTERSTITIAL, false)

To cache interstitial use:

Appodeal.cache(this, Appodeal.INTERSTITIAL)

Read more on manual caching in our FAQ.

Check If Ad Is Initialized

To check if interstitial was initialized, you can use the method:

Appodeal.isInitialized(Appodeal.INTERSTITIAL)

Returns true, if the interstitial was initialized.

Check If Autocache Is Enabled

To check if autocache is enabled for interstitial, you can use the method:

Appodeal.isAutoCacheEnabled(Appodeal.INTERSTITIAL)

Returns true, if autocache is enabled for interstitial.

Get Predicted eCPM

This method returns the expected eCPM for the cached ad. The amount is calculated based on historical data for the current ad unit.

Appodeal.getPredictedEcpm(Appodeal.INTERSTITIAL)
This method is reasonable to use if manual caching of ads is enabled.

Mute Videos If Call Volume Is Muted

You can mute the sound in a video interstitial using the method:

Appodeal.muteVideosIfCallsMuted(true)
note

This method works if the user's device has silent mode or only vibration enabled.

Check Viewability

You can always check in logs if show was tracked and your ad is visible.

You will see the Interstitial [Notify Shown] log if show was tracked successfully.

Appodeal  com.example.app  D Interstitial [Notify Shown]