Interstitial
Interstitial ads are full-screen advertisements.
In Appodeal, they are divided into two types - static interstitial and video interstitial.
Both types of ads are requested in parallel when caching and will be shown to be the most expensive of the two.
- Static interstitial - static full-screen banners.
- Video interstitial - these are videos that the user can close 5 seconds after the start of viewing.
You can use our demo interstitial app as a reference project.
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!
Appodeal.show()
returns a boolean value indicating whether the show method call was passed to the appropriate SDK.
Check If Ad Is Loaded
You can check the status of loading before showing. This method returns a boolean value indicating whether the interstitial is loaded.
Appodeal.isLoaded(Appodeal.INTERSTITIAL);
We recommend you always check whether an ad is available before trying to show it.
Example:
if(Appodeal.isLoaded(Appodeal.INTERSTITIAL)) { Appodeal.show(this, Appodeal.INTERSTITIAL); }
Placements
Appodeal SDK allows you to tag each impression with different placement. To use placements, you need to create placements in Appodeal Dashboard. Read more about placements.
To show an ad with placement, you have to call show method like this in your activity:
Appodeal.show(this, Appodeal.INTERSTITIAL, "yourPlacementName");
If the loaded ad can’t be shown for a specific placement, nothing will be shown. If auto caching is enabled, 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 the 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 and its settings will be applied.
Important!
Placement settings affect ONLY ad presentation, not loading or caching.
Callbacks
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 } });
Cache Ad Manually
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 right after the show method is called.
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);
Check If Ad Is Initialized
To check if interstitial was initialized, you can use the method:
Appodeal.isInitialized(Appodeal.INTERSTITIAL);
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);
true
, if autocache is enabled for interstitial.Get Predicted eCPM
To get the predicted eCPM from the next block in the caching queue, use the method:
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);
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]