Skip to main content

Android - Interstitial Ad

Overview


Interstitials, on the other hand, immediately present rich HTML5 experiences or “web apps” at natural app transition points such as launch, video pre-roll or game level load. Web apps are in-app browsing experiences with a simple close button rather than any navigation bar—the content provides its own internal navigation scheme. Interstitial ads are typically more expensive and subject to impression constraints.

Note: We suggest that you should put the interstitial ads in the portrait mode for the best visual performance.

Prerequisites


Please make sure you’ve imported Vpon SDK to your Xcode project. If not, please refer to our Integration Guide to finish your setting.

Start To Implement Interstitial


The richer, more heavyweight nature of Vpadn interstitial is reflected by its definition not as a UIView but rather an NSObject requiring more distinct instantiation, load and display steps.

Usage is nevertheless very similar to Vpadn banner:

  1. Import com.vpadn.ads.*
  2. Declare a VpadnInterstitialAd instance
  3. Set up VpadnInterstitialAd instance and indicate a License Key
  4. Request for an Interstitial Ad
  5. Show Interstitial Ad
  6. Implement VpadnAdListener

We strongly recommend that you can finish all the steps in the Activity of the application.

Import Vpon SDK And Declare A VpadnInterstitialAd Instance


import com.vpadn.ads.*;

public class MainActivity extends Activity implements VpadnAdListener {
    // Declare VpadnInterstitialAd instance
  	private VpadnInterstitialAd interstitialAd;

  	// Please fill in with your License Key
  	private String interstitialBannerId = "License Key";
        ...
}

Set Up VpadnInterstitialAd Instance And Indicate A License Key


public class MainActivity extends Activity implements VpadnAdListener {
  ...
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    // Create VpadnInterstitialAd instance
    interstitialAd = new VpadnInterstitialAd(this, interstitialBannerId, "TW");
    interstitialAd.setAdListener(this);
    VpadnAdRequest request = new VpadnAdRequest();
    // Start to load Interstitial Ad
    interstitialAd.loadAd(request);
  }

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

You can only show Interstitial Ad after the ad request success.

Show Interstitial Ad


Please avoid to show Interstitial Ad right away after ad request. We recommend that you can request Interstitial Ad first and show it in a specific moment. For example, you can implment VpadnAdListener and show ad when onVpadnReceiveAd be triggered.

public class MainActivity extends Activity implements VpadnAdListener {
  ...

    @Override
    public void onVpadnReceiveAd(VpadnAd ad) {
      if (ad == this.interstitialAd) {
        // Show Interstitial Ad
        interstitialAd.show();
      }
    }
    ...
}

Request for Test Ad


Please add the code snippet to your application and fill in with your test device’s UUID as below to request for test ads.

public class MainActivity extends Activity implements VpadnAdListener {
        ...
        VpadnAdRequest adRequest =  new VpadnAdRequest();

        HashSet<String> testDeviceImeiSet = new HashSet<String>();
        // Add Android device advertising id
        testDeviceImeiSet.add("your device advertising id");
        adRequest.setTestDevices(testDeviceImeiSet);

        vponBanner.loadAd(adRequest);
        ...
}

Advertising ID


Here are some tips for you to get your advertising id:

  1. Search “advertising_id” from the log
  2. Check the advertising id in the Setting of your device

Implement VpadnAdListener


public class MainActivity extends Activity implements VpadnAdListener {
        @Override
        public void onVpadnReceiveAd(VpadnAd ad){
                Log.d("Banner", "VpadnReceiveAd");
        }

        @Override
        public void onVpadnFailedToReceiveAd(VpadnAd ad, VpadnAdRequest.VpadnErrorCode errCode){
                Log.d("Banner", "fail to receive ad (" + errCode + ")");
        }

        @Override
        public void onVpadnPresentScreen(VpadnAd ad){
                Log.d("Banner", "VpadnPresentScreen");
        }

        @Override
        public void onVpadnDismissScreen(VpadnAd ad){
                Log.d("Banner", "vpadnDismissScreen");
        }

        @Override
        public void onVpadnLeaveApplication(VpadnAd ad){
                Log.d("Banner", "VpadnLeaveApplication");
        }
}

Tips


  • We recommend that you can get Interstitial Ad first and show it after a specific event happened instead of load ad and show it immediately.

  • Please follow our Integration Guide to add VpadnActivity in your AndroidManifest.xml. If you didn’t add android:configChanges=“orientation|screenSize” in VpadnActivity, please avoid to loadAd() and show Interstitial Ad in onCreate section.

Sample Code

Please refer to our Sample Code for a complete integration sample.

More Ad Formats

Please refer to the link below to learn more about other ad types: