# InterstitialAd

**package com.intowow\.sdk**

**public class InterstitialAd extends Ad**

![](/files/-LGU_wbQ__McDpQn1Ze9)

### Characteristics

* Takes up the whole screen. Users could engage with the ad or close the ad and back to app.
* Support portrait and landscape mode.
* Support image and video.
* Video is mute by default, and can be toggled by clicking it.

### Recommended Ad Placement

* [Interstitial](/crystalexpress-documentation-v3-x/android-sdk/integration-scenarios/interstitial.md)

### Request an ad

* Declare InterstitialAdActivity to AndroidManifest.xml

```markup
<activity
  android:name="com.intowow.sdk.InterstitialAdActivity"
  android:configChanges="orientation|screenSize"
  android:launchMode="singleTask"
  android:screenOrientation="portrait"
  android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen" >
</activity>
```

* You could request an ad by:

```java
private InterstitialAd mInterstitialAd = null;
private final static String PLACEMENT_NAME = "Obtain from your Intowow account manager";

@Override
protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  mInterstitialAd = new InterstitialAd(mActivity);
  RequestInfo requestInfo = new RequestInfo();
  requestInfo.setPlacement(PLACEMENT_NAME);
  requestInfo.setTimeout(LOAD_AD_TIMEOUT);

  mInterstitialAd.setAdListener(new CEInterstitialAdListener() {

    @Override
    public void onAdDisplayed(Ad ad) {
    }

    @Override
    public void onAdDismissed(Ad ad) {
    }

    @Override
    public void onAdClicked(Ad ad) {
    }

    @Override
    public void onAdImpression(Ad ad) {
    }

    @Override
    public void onAdMute(Ad ad) {
    }

    @Override
    public void onAdUnmute(Ad ad) {
    }

    @Override
    public void onVideoEnd(Ad arg0) {
    }

    @Override
    public void onVideoProgress(Ad arg0, int totalDuration, int currentPosition) {
    }

    @Override
    public void onVideoStart(Ad arg0) {
    }

  });

  mInterstitialAd.loadAdAsync(requestInfo, new CEAdRequestListener() {
    @Override
    public void onError(Ad ad, AdError error) {
    }

    @Override
    public void onAdLoaded(Ad ad) {
        if(mInterstitialAd != ad) {
            return;
        }
        //  Start InterstitialAdActivity for showing this ad.
        //
    mInterstitialAd.show();      
    }
  });
}
```

* remember to release ad if it is no longer to use.

```java
@Override
protected void onDestroy() {
    if(mInterstitialAd != null) {
        mInterstitialAd.destroy();
        mInterstitialAd = null;
    }
    ...
    ...
    super.onDestroy();
}
```

### Advance Integration

* If you want the ad to enter the screen with animation effect, please use [show(int enterAnim, int exitAnim)](/crystalexpress-documentation-v3-x/android-sdk/api-reference/ad/interstitialad.md#show2) after ad loaded.
* If you want to close the interstitial ad after user clicks the ad, please use [setAutoCloseWhenEngaged(boolean isAutoClose)](/crystalexpress-documentation-v3-x/android-sdk/api-reference/ad/interstitialad.md#setAutoCloseWhenEngaged) before you call [loadAdInstant](/crystalexpress-documentation-v3-x/android-sdk/api-reference/ad/interstitialad.md#loadadinstant)/[loadAdAsync](/crystalexpress-documentation-v3-x/android-sdk/api-reference/ad/interstitialad.md#loadadasync).

| Public constructors                                                                                                                                  |
| ---------------------------------------------------------------------------------------------------------------------------------------------------- |
| <p><a href="/pages/-LGU_vTJ-qyuZzinnDAr#InterstitialAd">InterstitialAd(Context context)</a> <br>Instantiates a new interstitial ad.</p>              |
| <p><a href="/pages/-LGU_vTJ-qyuZzinnDAr#InterstitialAd">InterstitialAd(Context context, Map adProps)</a> <br>Instantiates a new interstitial ad.</p> |

| Public methods                                                                                     |                                                                                                                                                                                                                                                                                                 |
| -------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| void                                                                                               | <p><a href="/pages/-LGU_vTJ-qyuZzinnDAr#close">close()</a> <br> Close the InterstitialActivity directly.</p>                                                                                                                                                                                    |
| void                                                                                               | <p><a href="/pages/-LGU_vTJ-qyuZzinnDAr#destroy">destroy()</a> <br> Release the interstitial ad.</p>                                                                                                                                                                                            |
| [CERequestResult](/crystalexpress-documentation-v3-x/android-sdk/api-reference/cerequestresult.md) | <p><a href="/pages/-LGU_vTJ-qyuZzinnDAr#loadadinstant">loadAdInstant(RequestInfo requestInfo)</a> <br> Load ad with requestInfo (<strong>synchronous</strong>)</p>                                                                                                                              |
| void                                                                                               | <p><a href="/pages/-LGU_vTJ-qyuZzinnDAr#loadadasync">loadAdAsync(RequestInfo requestInfo, CEAdRequestListener listener)</a></p><p>Load ad with requestInfo (<strong>asynchronous</strong>)</p>                                                                                                  |
| void                                                                                               | <p><a href="/pages/-LGU_vTJ-qyuZzinnDAr#setAdListener">setAdListener(CEInterstitialAdListener listener)</a> <br> Set the ad listener.</p>                                                                                                                                                       |
| void                                                                                               | <p><a href="/pages/-LGU_vTJ-qyuZzinnDAr#setAutoCloseWhenEngaged">setAutoCloseWhenEngaged(boolean isAutoClose)</a> <br> Instruct SDK to close the interstitial ad after user clicks the ad. <br> <strong>You should call this method before loadAdInstant/loadAdAsync if necessary.</strong></p> |
| void                                                                                               | <p><a href="/pages/-LGU_vTJ-qyuZzinnDAr#show1">show()</a> <br> Start the InterstitialActivity. <br> <strong>You should call this method after onAdLoaded().</strong></p>                                                                                                                        |
| void                                                                                               | <p><a href="/pages/-LGU_vTJ-qyuZzinnDAr#show2">show(int enterAnim, int exitAnim)</a> <br> Start the InterstitialActivity with animation effect. <br> <strong>You should call this method after onAdLoaded().</strong></p>                                                                       |

| Inherited methods |                                                                                                                                                                                                                                                                                                   |
| ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| int               | <p><a href="https://github.com/intowow/crystalexpress-documentation-v3-x/tree/eea8a8ed348d77ae2fac3bcbe123fc19fcc36f5c/android/api_reference/ad.html#getAdId">getAdId()</a> <br> Get the ad id.</p>                                                                                               |
| String            | <p><a href="https://github.com/intowow/crystalexpress-documentation-v3-x/tree/eea8a8ed348d77ae2fac3bcbe123fc19fcc36f5c/android/api_reference/ad.html#getCampaignId">getCampaignId()</a> <br> Get the campaign id.</p>                                                                             |
| String            | <p><a href="https://github.com/intowow/crystalexpress-documentation-v3-x/tree/eea8a8ed348d77ae2fac3bcbe123fc19fcc36f5c/android/api_reference/ad.html#getEngageUrl">getEngageUrl()</a> <br> Get the engage url.</p>                                                                                |
| int               | <p><a href="https://github.com/intowow/crystalexpress-documentation-v3-x/tree/eea8a8ed348d77ae2fac3bcbe123fc19fcc36f5c/android/api_reference/ad.html#getPlace">getPlace()</a> <br> Get the ad place.</p>                                                                                          |
| String            | <p><a href="https://github.com/intowow/crystalexpress-documentation-v3-x/tree/eea8a8ed348d77ae2fac3bcbe123fc19fcc36f5c/android/api_reference/ad.html#getPlacement">getPlacement()</a> <br> Get the ad placement.</p>                                                                              |
| Rect              | <p><a href="https://github.com/intowow/crystalexpress-documentation-v3-x/tree/eea8a8ed348d77ae2fac3bcbe123fc19fcc36f5c/android/api_reference/ad.html#getSize">getSize()</a> <br> Get the ad size. <br> <strong>It should be called after onAdLoaded().</strong></p>                               |
| String            | <p><a href="https://github.com/intowow/crystalexpress-documentation-v3-x/tree/eea8a8ed348d77ae2fac3bcbe123fc19fcc36f5c/android/api_reference/ad.html#getToken">getToken()</a> <br> Get the ad token for tracking.</p>                                                                             |
| long              | <p><a href="https://github.com/intowow/crystalexpress-documentation-v3-x/tree/eea8a8ed348d77ae2fac3bcbe123fc19fcc36f5c/android/api_reference/ad.html#getTotalFileSize">getTotalFileSize()</a> <br> Get the ad file size on device.</p>                                                            |
| String            | <p><a href="https://github.com/intowow/crystalexpress-documentation-v3-x/tree/eea8a8ed348d77ae2fac3bcbe123fc19fcc36f5c/android/api_reference/ad.html#getVideoCoverPath">getVideoCoverPath()</a> <br> Get video cover file path. <br> <strong>It should be called after onAdLoaded().</strong></p> |
| boolean           | <p><a href="https://github.com/intowow/crystalexpress-documentation-v3-x/tree/eea8a8ed348d77ae2fac3bcbe123fc19fcc36f5c/android/api_reference/ad.html#hasVideoContent">hasVideoContent()</a> <br> Check if the ad has video content or not.</p>                                                    |
| boolean           | <p><a href="https://github.com/intowow/crystalexpress-documentation-v3-x/tree/eea8a8ed348d77ae2fac3bcbe123fc19fcc36f5c/android/api_reference/ad.html#isValid">isValid()</a> <br> Check if the ad is still valid for serving.</p>                                                                  |
| void              | <p><a href="https://github.com/intowow/crystalexpress-documentation-v3-x/tree/eea8a8ed348d77ae2fac3bcbe123fc19fcc36f5c/android/api_reference/ad.html#setSize">setSize(Rect rect)</a> <br> Set the ad size.</p>                                                                                    |

## Public constructors

### InterstitialAd <a href="#interstitialad" id="interstitialad"></a>

InterstitialAd(Context context)

Instantiates a new interstitial ad.

| Parameters |                       |
| ---------- | --------------------- |
| context    | Context: the context. |

## Public methods

### close <a href="#close" id="close"></a>

void close()

Close the InterstitialActivity directly.

### destroy <a href="#destroy" id="destroy"></a>

void destroy()

Release the ad.

### loadAdInstant <a href="#loadadinstant" id="loadadinstant"></a>

[CERequestResult](/crystalexpress-documentation-v3-x/android-sdk/api-reference/cerequestresult.md) loadAdInstant(RequestInfo requestInfo)

Load ad with RequestInfo **(synchronous)**

| Parameters  |                                                                                                                                             |
| ----------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
| requestInfo | [RequestInfo](/crystalexpress-documentation-v3-x/android-sdk/api-reference/requestinfo.md): the request info such as placement and timeout. |

### loadAdAsync <a href="#loadadasync" id="loadadasync"></a>

void loadAdAsync(RequestInfo requestInfo,[ CEAdRequestListene](/crystalexpress-documentation-v3-x/android-sdk/api-reference/ceadrequestlistener.md)r listener)

Load ad with RequestInfo **(asynchronous)**

| Parameters  |                                                                                                                                             |
| ----------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
| requestInfo | [RequestInfo](/crystalexpress-documentation-v3-x/android-sdk/api-reference/requestinfo.md): the request info such as placement and timeout. |
| listener    | [CEAdRequestListener](/crystalexpress-documentation-v3-x/android-sdk/api-reference/ceadrequestlistener.md): know the result of loadAdAsync  |

### setAdListener <a href="#setadlistener" id="setadlistener"></a>

void setAdListener([CEInterstitialAdListener](/crystalexpress-documentation-v3-x/android-sdk/api-reference/ad/interstitialad/ceinterstitialadlistener.md) listener)

Set the ad listener.

| Parameters |                                                                                                                                                          |
| ---------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- |
| listener   | [CEInterstitialAdListener](/crystalexpress-documentation-v3-x/android-sdk/api-reference/ad/interstitialad/ceinterstitialadlistener.md): the ad listener. |

### setAutoCloseWhenEngaged <a href="#setautoclosewhenengaged" id="setautoclosewhenengaged"></a>

void setAutoCloseWhenEngaged(boolean isAutoClose)

Instruct SDK to close the interstitial ad after user clicks the ad. **You should call this method before loadAdInstant/loadAdAsync if necessary.**

| Parameters  |                                                   |
| ----------- | ------------------------------------------------- |
| isAutoClose | boolean: if auto close when ad is engaged or not. |

### show <a href="#show1" id="show1"></a>

void show()

Start the InterstitialActivity. **You should call this method after onAdLoaded().**

### show <a href="#show2" id="show2"></a>

void show(int enterAnim, int exitAnim)

Start the InterstitialActivity with animation effect. **You should call this method after onAdLoaded().**

| Parameters |                                                                                                        |
| ---------- | ------------------------------------------------------------------------------------------------------ |
| enterAnim  | int: A resource ID of the animation resource to use for the incoming activity. Use 0 for no animation. |
| exitAnim   | int: A resource ID of the animation resource to use for the outgoing activity. Use 0 for no animation. |


---

# Agent Instructions: 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:

```
GET https://intowow.gitbook.io/crystalexpress-documentation-v3-x/android-sdk/api-reference/ad/interstitialad.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
