Integrating Interstitial Ads

Document created by david.simerly on Oct 24, 2017Last modified by david.simerly on Apr 3, 2018
Version 10Show Document
  • View in full screen mode

PubMatic SDKs 

PubMatic Android SDK

Getting Started

Integrating Banner Ads

➤  Integrating Interstitial Ads

Rich Media (MRAID 2.0) Support

Integrating Native Ads

Header Bidding With DFP

Passing Targeting Information

SDK Debugging

PubMatic Android SDK Reference 

Interstitial ads are full-screen ads displayed at transition points in an app; for example, when the app launches, when moving between screens, and so on. Interstitial ads exhibit the following behavior:


  • Always includes a Close button; either immediately, or shortly after, the ad displays.
  • One-time ad; once the ad closes the same PMInterstitialAd object cannot display it again.


You'll need to follow the instructions in Getting started before proceeding with the following integration steps. You'll also find a useful example integration in pubmatic-sample-app included in the SDK download bundle.



Once you've downloaded and installed the PubMatic Android SDK, use the following sections to implement and configure Interstitial ads:



Display Interstitial Ad

The following steps demonstrate how to integrate Interstitial ads with your app:


Step 1: Setup Interstitial ad

Create an instance of PMInterstitialAd:


PMInterstitialAd interstitialAd = new PMInterstitialAd(<Context>);


Be sure to pass the Activity context when creating an instance of PMInterstitialAd.


Step 2: Create Ad Request

Create an instance of PMInterstitialAdRequest and set the targeting parameters:


PMInterstitialAdRequest adRequest = PMInterstitialAdRequest.createPMInterstitialAdRequest(
        <PubId>, <SiteId>, <AdId>);


For more targeting parameters, see Passing Targeting Information.


Step 3: Request the ad

Send the adRequest using loadRequest() from the interstitialAd instance:




Step 4: Receive Interstitial callbacks and present the Interstitial ad

Optionally, you can register a listener to report success and failure callbacks from the ad request:


interstitialAd.setRequestListener(new PMInterstitialAd.InterstitialAdListener.RequestListener() {
    public void onFailedToReceiveAd(PMInterstitialAd adView, final PMError error) {
    public void onReceivedAd(PMInterstitialAd adView) {
        if(mInterstitialAd.isReady()) {


See PubMatic SDK Error Codes for a detailed description of the PMError object used in the interstitialAd.onFailedToReceiveAd() callback.


Best Practices:


  • Before displaying the Interstitial ad, make sure it's ready using the isReady() method from the PMInterstitialAd object, as shown in step 4 above.
  • Use show() or showForDuration() method from the PMInterstitialAd object to display a full-screen Interstitial ad. The ad displays only after it successfully loads.
  • Call the show() or showForDuration() method from onReceivedAd() callback to display the ad faster. This also ensures that a full-screen Interstitial ad view displays only after the ad is successfully received from the server.
  • Remember that Interstitial ads are a one-time ads that display only once. To request another ad, call loadRequest() again or create a new PMInterstitialAd instance.


Step 5: Deallocate the Interstitial ad resources

Deallocate the PMInterstitialAd instance before your Activity is destroyed:




Set Optional Listeners

PubMatic SDK also provides optional listeners that you can register for other callbacks as shown below:


Implement respective listeners in place of any place holders.


// Invoked when the ad will navigate to a clicked link (or rich media open). 
// Set an interface to notify the events of MRAID ads
// Set an interface allowing you to control which device features are exposed to rich media ads
// Set an interface to notify the activity of internal browser.


To fully support all MRAID events please follow the steps in Rich Media (MRAID 2.0) Ads.