Pangle: A global platform dedicated to developer growth.|Integration Docs
Knowledge Center

Interstitial Ads

Introduction

The Interstitial Ads is that cover the interface of an app until closed by the user. It can be skipped after 5 seconds. They're typically displayed at natural transition points in the flow of an app, such as between activities or during the pause between levels in a game. When an app shows an interstitial ad, the user has the choice to either tap on the ad and continue to its destination or close it and return to the app.

Precondition

Create an app and Interstitial ad placement on Pangle platform

Pangle Platform Parameter Setting:

  • Orienation: Select the orientation of the video.

Interstitial Ad Implementation

  1. Create PAGInterstitialRequest object
  1. Load a Interstitial ad and Register PAGInterstitialAdLoadListener callbacks.
  1. Register ad event callbacks.
  1. Display the ad.

Load an Interstitial Ad

Loading an ad is accomplished using the load() method on the PAGInterstitialAd class. The load() method requires an ad slot id, an instance object of PAGInterstitialRequest, and a PAGInterstitialAdLoadListener to be notified when ad loading succeeds or fails. The loaded PAGInterstitialAd object is provided as a parameter in the success callback.

Create PAGInterstitialRequest object

PAGInterstitialRequest is a Ad Loading Manager. It is recommended to be the member variable of the Activity.

Load an ad and Register PAGInterstitialAdLoadListener callback

Use the method of PAGInterstitialAd to load the ad, and register the PAGInterstitialAdLoadListener callback.

The description of PAGInterstitialAdLoadListener callback

PAGInterstitialAdLoadListener

description

onError

This method is invoked when an ad fails to load. It includes an error parameter of type Error that indicates what type of failure occurred. For more information, refer to the ErrorCode section

onAdLoaded

This method is executed when an ad material is loaded successfully.

Register Ad Event Callback

Ad event callbacks need to be registered before displaying an ad. Each method in the event callback corresponds to an event in the ad lifecycle.

The description of PAGInterstitialAdInteractionListener callback

PAGInterstitialAdInteractionListener

description

onAdShowed

This method is invoked when the ad is displayed, covering the device's screen.

onAdClicked

This method is invoked when the ad is clicked by the user.

onAdDismissed

This method is invoked when the ad disappears.

Display the Ad

An instance of the PAGInterstitialAd object will be returned when the ad is loaded successfully. Call the show()method of PAGInterstitialAd to render the ad and it needs to pass in activity, and it must should be called in the main thread.

Test with test ads

Now you have finished the integration. If you wanna test your apps, make sure you use test ads rather than live, production ads. The easiest way to load test ads is to use test mode. It's been specially configured to return test ads for every request, and you're free to use it in your own apps while coding, testing, and debugging.

Refer to the How to add a test device? to add your device to the test devices on Pangle platform.