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.
  • Ad TypeVideo Only(Default) / Video & Image(added).

Interstitial Ad Implementation

The main steps to integrate interstitial ads are:

  • Load an interstitial ad.
  • Register ad event callbacks.
  • Display the ad.
  • Preload an interstitial ad.

Load an Interstitial Ad

Loading an ad is accomplished using the loadFullScreenVideoAd method on the TTAdNative class. The loadFullScreenVideoAd method requires an AdSlot Object and a FullScreenVideoAdListener to be notified when ad loading succeeds or fails. The loaded TTFullScreenVideoAd object is provided as a parameter in the onFullScreenVideoAdLoad(TTFullScreenVideoAd ttFullScreenVideoAd) callback.

Create the TTAdNative Object

TTAdNative is an Ad Loading Manager. It is recommended to be the member variable of the Activity. You always need to create a TTAdNative Object before loading ads.

Create the AdSlot Object

In this section, you need to pass ad placement id in the method setCodeId().

Load a Interstitial Ad and Register FullScreenVideoAdListener Callback

Calling the loadFullScreenVideoAd() method on the TTAdNative class to load a Fullscreen Video Ad.

FullScreenVideoAdListener callback

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

onFullScreenVideoCached

This method is executed when the video file has finished loading.

onFullScreenVideoAdLoad

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

Register Ad Event Callbacks

Before the ad to be shown, you need to register ad event callbacks. Passing a FullScreenVideoAdInteractionListener object to the setter on your ad. The FullScreenVideoAdInteractionListener provides some Ad Event methods to get notifications of rewarded ad events. Each of the methods in FullScreenVideoAdInteractionListener corresponds to an event in the lifecycle of a fullscreen video ad.

FullScreenVideoAdInteractionListener Callback Instruction

FullScreenVideoAdInteractionListener callback

Description

onAdVideoBarClick

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

onAdClose

This method is invoked when the ad is closed due to the user tapping on the close icon on the endcard.

onVideoComplete

This method is invoked when the video has finished playing.

onSkippedVideo

The method is invoked when the user skipped the video.

onAdShow

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

Display the Ad

Interstitial ads should be displayed during natural pauses in the flow of an app.

To show an interstitial ad, we recommend using the onFullScreenVideoCached() method to verify if it's finished loading, then call showFullScreenVideoAd() on TTFullScreenVideoAd. The showFullScreenVideoAd() method requires Activity instance. The Activity instance should be the activity from which the interstitial video ad is presented.

Preload an Interstitial Ad

The best practice is to load another interstitial ad in the onAdClose() method on FullScreenVideoAdInteractionListener so that the next interstitial ad starts loading as soon as the previous one is closed:

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.