> For the complete documentation index, see [llms.txt](https://docs.digitalturbine.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.digitalturbine.com/dt-exchange/sdk-configuration/integrating-the-android-sdk/android-ad-formats/interstitial-ads.md).

# Interstitial Ads

Interstitial ads are full-screen, video, or interactive ads that appear at natural transition points within an app, such as between levels in a game or when a user is switching screens.

## Building the Ad Placement (Ad Spot) <a href="#h_01hvkbkvndmc7debb39s7m019a" id="h_01hvkbkvndmc7debb39s7m019a"></a>

Add the required controllers to set up the ad placement:

{% code title="Java" %}

```java
// Spot integration for fullscreen ad
InneractiveAdSpot mSpot = InneractiveAdSpotManager.get().createSpot();

// Adding the fullscreen controller
InneractiveFullscreenUnitController controller = new InneractiveFullscreenUnitController();

// Adding the video fullscreen controller
InneractiveFullscreenVideoContentController videoContentController = new InneractiveFullscreenVideoContentController();

// Adding the video fullscreen controller to the adview controller
controller.addContentController(videoContentController);
mSpot.addUnitController(controller);
```

{% endcode %}

## Adding Listeners <a href="#h_01hvkbkvnehw0td9r706p2fqtc" id="h_01hvkbkvnehw0td9r706p2fqtc"></a>

Add listeners for the controller and the spot.

### Adding Event Listener for the Controller <a href="#id-01k7bvqjscbadywmxscy8jpvwg" id="id-01k7bvqjscbadywmxscy8jpvwg"></a>

The example below demonstrates how you would add an `EventListener` to receive Interstitial ad callbacks:

#### Events: <a href="#h_01hvkbkvne4hgvgce0asmb7q44" id="h_01hvkbkvne4hgvgce0asmb7q44"></a>

{% code title="Java" %}

```java
controller.setEventsListener(new InneractiveFullscreenAdEventsListener() {
    @Override
    public void onAdImpression(InneractiveAdSpot inneractiveAdSpot) {
    }
    @Override
    public void onAdClicked(InneractiveAdSpot inneractiveAdSpot) {
    }
    @Override
    public void onAdWillOpenExternalApp(InneractiveAdSpot inneractiveAdSpot) {
    }
    @Override
    public void onAdEnteredErrorState(InneractiveAdSpot inneractiveAdSpot, InneractiveUnitController.AdDisplayError adDisplayError) {
    }
    @Override
    public void onAdWillCloseInternalBrowser(InneractiveAdSpot inneractiveAdSpot) {
    }
    @Override
    public void onAdDismissed(InneractiveAdSpot inneractiveAdSpot) {
    }
});
```

{% endcode %}

#### Video Events: <a href="#id-01k5dsgnhxvf76ehvhtnx708t5" id="id-01k5dsgnhxvf76ehvhtnx708t5"></a>

{% code title="Java" %}

```java
videoContentController.setEventsListener(new VideoContentListener() {
    @Override
    public void onProgress(int totalDurationInMsec, int positionInMsec) {
    }
    @Override
    public void onCompleted() {
    }
    @Override
    public void onPlayerError() {
        /**
         * Note: onPlayerError callback method is deprecated starting from VAMP v7.3.0,
         and won't be triggered when an error occurs. 
         * Note: The SDK handles such errors internally and no further action is required.
         */
    }
});
```

{% endcode %}

### Adding Request Listener for the Spot <a href="#id-01k7bvzbg0w7xfbzs6q3z8n3de" id="id-01k7bvzbg0w7xfbzs6q3z8n3de"></a>

The example below demonstrates how you would add a `RequestListener` for the Spot:

{% code title="Java" %}

```java
InneractiveAdSpot.RequestListener mSpotListener = new InneractiveAdSpot.RequestListener() 
{
    @Override
    // When the ad request sends successfully
    public void onInneractiveSuccessfulAdRequest(InneractiveAdSpot inneractiveAdSpot) {
    }
    @Override
    // When the ad request fails to send
    public void onInneractiveFailedAdRequest(InneractiveAdSpot inneractiveAdSpot, InneractiveErrorCode inneractiveErrorCode) {
    }
};
mSpot.setRequestListener(mSpotListener);
```

{% endcode %}

## Fetching the Ad <a href="#h_01hvkbkvnefs11qf08d4tkg0b9" id="h_01hvkbkvnefs11qf08d4tkg0b9"></a>

The way in which the ad is fetched depends on the mediation type — Waterfall or SDK Bidding.

### Fetching the Ad for Waterfall <a href="#id-01k7bw5f6pqa50yp10d7f72rzj" id="id-01k7bw5f6pqa50yp10d7f72rzj"></a>

In Waterfall mediation, use `InneractiveAdRequest adRequest` to request the ad:

{% code title="Java" %}

```java
InneractiveAdRequest adRequest = new InneractiveAdRequest("add_your_interstitial_spot_id");

// To perform the ad request
mSpot.requestAd(adRequest);
```

{% endcode %}

Optionally, you can mute ads by including `setMuteVideo(true)`:

{% code title="Java" %}

```java
InneractiveAdManager.setMuteVideo(true);
```

{% endcode %}

### Fetching the Ad for SDK Bidding <a href="#id-01k7bw8tsecy5e54ajw4wk5s6h" id="id-01k7bw8tsecy5e54ajw4wk5s6h"></a>

In SDK Bidding, DT Exchange must first generate a token for the Mediation SDK to use when identifying the request to the server.

Use `getBidderToken` to generate a Bidder Token in a background thread:

{% code title="Java" %}

```java
BidTokenProvider.getBidderToken();
```

{% endcode %}

Return type: `java.lang.String`. If an error occurs, the returned value is null.

If DT Exchange wins the auction, load the ad with the `signaldata (adm)` that was received from the server:

{% code title="Java" %}

```java
public void loadAd(String admPayload);
```

{% endcode %}

If the load is successful: `public void onInneractiveSuccessfulAdRequest(InneractiveAdSpot inneractiveAdSpot)` callback is invoked.

If the ad fails to load: `public void onInneractiveFailedAdRequest(InneractiveAdSpot inneractiveAdSpot, InneractiveErrorCode inneractiveErrorCode)` callback is invoked.

## Displaying the Ad <a href="#h_01hvkbkvne8tjpcw8xwbfeys7r" id="h_01hvkbkvne8tjpcw8xwbfeys7r"></a>

After a successful ad request, use `mSpot.isReady` to confirm the ad is ready and `controller.show(this);` to display the Ad:

{% code title="Java" %}

```java
// Checking if we have ad content
if (mSpot.isReady()) {
// Getting the spot's controller
    InneractiveFullscreenUnitController controller = (InneractiveFullscreenUnitController)mSpot.getSelectedUnitController();
// Showing the ad using the Activity's context
    controller.show(this);
}
```

{% endcode %}

## Releasing an Ad Placement <a href="#releasing-an-a-d-placement-0-17" id="releasing-an-a-d-placement-0-17"></a>

DT recommends releasing the allocated resources for ad display. For more information, see [Releasing Ad Instance Resources](/dt-exchange/sdk-configuration/integrating-the-android-sdk/releasing-ad-instance-resources.md).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.digitalturbine.com/dt-exchange/sdk-configuration/integrating-the-android-sdk/android-ad-formats/interstitial-ads.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
