Interstitial
Interstitial ads are full-screen advertisements.
You can use our demo interstitial app as a reference project.
Demo App
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.
- Kotlin
- Java
Appodeal.isLoaded(Appodeal.INTERSTITIAL)
Appodeal.isLoaded(Appodeal.INTERSTITIAL);
We recommend you always check whether an ad is available before trying to show it.
- Kotlin
- Java
if (Appodeal.isLoaded(Appodeal.INTERSTITIAL)) {
Appodeal.show(this, Appodeal.INTERSTITIAL)
}
if (Appodeal.isLoaded(Appodeal.INTERSTITIAL)) {
Appodeal.show(this, Appodeal.INTERSTITIAL);
}
Display
To display interstitial, you need to call the following code in the activity:
- Kotlin
- Java
Appodeal.show(this, Appodeal.INTERSTITIAL)
Appodeal.show(this, Appodeal.INTERSTITIAL);
The method returns a boolean value indicating whether the call to the show method was passed to the appropriate SDK.
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:
- Kotlin
- Java
Appodeal.setAutoCache(Appodeal.INTERSTITIAL, false)
Appodeal.setAutoCache(Appodeal.INTERSTITIAL, false);
To cache interstitial use:
- Kotlin
- Java
Appodeal.cache(this, Appodeal.INTERSTITIAL)
Appodeal.cache(this, Appodeal.INTERSTITIAL);
Read more on manual caching in our FAQ.
Callbacks
- Kotlin
- Java
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
}
})
Appodeal.setInterstitialCallbacks(new InterstitialCallbacks() {
@Override
public void onInterstitialLoaded(boolean isPrecache) {
// Called when interstitial is loaded
}
@Override
public void onInterstitialFailedToLoad() {
// Called when interstitial failed to load
}
@Override
public void onInterstitialShown() {
// Called when interstitial is shown
}
@Override
public void onInterstitialShowFailed() {
// Called when interstitial show failed
}
@Override
public void onInterstitialClicked() {
// Called when interstitial is clicked
}
@Override
public void onInterstitialClosed() {
// Called when interstitial is closed
}
@Override
public void onInterstitialExpired() {
// Called when interstitial is expired
}
});
All callbacks are called on the main thread.
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.
- Kotlin
- Java
Appodeal.show(this, Appodeal.INTERSTITIAL, "yourPlacementName")
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:
- Kotlin
- Java
if (Appodeal.canShow(Appodeal.INTERSTITIAL, "yourPlacementName")) {
Appodeal.show(this, Appodeal.INTERSTITIAL, "yourPlacementName")
}
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.
Placement settings affect ONLY ad presentation, not loading or caching.
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.
- Kotlin
- Java
Appodeal.getPredictedEcpm(Appodeal.INTERSTITIAL)
Appodeal.getPredictedEcpm(Appodeal.INTERSTITIAL);
Check If Ad Is Initialized
To check if interstitial was initialized, you can use the method:
- Kotlin
- Java
Appodeal.isInitialized(Appodeal.INTERSTITIAL)
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:
- Kotlin
- Java
Appodeal.isAutoCacheEnabled(Appodeal.INTERSTITIAL)
Appodeal.isAutoCacheEnabled(Appodeal.INTERSTITIAL);
Returns true
, if autocache is enabled for interstitial.
Mute Videos If Call Volume Is Muted
You can mute the sound in a video interstitial using the method:
- Kotlin
- Java
Appodeal.muteVideosIfCallsMuted(true)
Appodeal.muteVideosIfCallsMuted(true);
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.
- Log
Appodeal com.example.app D Interstitial [Notify Shown]