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

App Open Ads

💡 Pangle SDK supports App Open Ads from version 4300 and above

Introduction

App open ads are a special ad format intended for publishers wishing to monetize their app load screens. App open ads can be closed at any time, and are designed to be shown when your users bring your app to the foreground.

Precondition

Create an app and App Open ad placement on Pangle platform

App Open Ads Implementation

The main steps to integrate App Open ads are:

  • Set the host app icon
  • Load an ad
    • Listen for AppOpenAdListener
  • Show the ad
    • Listen for AppOpenAdInteractionListener

Set Host APPIcon

set the host app icon when initializing the Pangle SDK.

Load an Ad

The app open ad is requested by the loadAppOpenAd() method of the TTAdNative class. The loadAppOpenAd method requires an AdSlot object, an AppOpenAdListener and a timeout parameter. AdSlot is the information requested by the user, AppOpenAdListener is a callback indicating whether the loading succeeds or fails, and timeout is a parameter that needs to be set for the request timeout.

Create the TTAdNative Object

TTAdNative is an Ad Loading Manager. It is recommended to be the member variable of the Activity.

Create the AdSlot Object

App Open Ads fill the entire screen by default.

Load a App Open Ad and Register AppOpenAdListener Callback

Call the loadAppOpenAd() method of the TTAdNative class to load the ad. AdSlot, AppOpenAdListener, timeout objects are required. The TTAppOpenAd object is returned as a parameter in the onAppOpenAdLoaded callback.

AppOpenAdListener Description

AppOpenAdListener 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.

onAppOpenAdLoaded()

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

Load an App Open

App Open ad timeout recommended >=3000ms

Show the Ad

After the loading is successful, you need to call the showAppOpenAd() method to render the ad.

Register Ad Event Callbacks and Show Ad

Warning:

  1. After the ad is loaded, you need to register for ad event callbacks. Pass an AppOpenAdInteractionListener object to the ad's setter. AppOpenAdInteractionListener provides some ad event methods to get notified of ads.
  2. An interactive listener (AppOpenAdInteractionListener), which must be handled before the showAppOpenAd() method is called. If you don't call the showAppOpenAd() method, you don't need to set up a listener for the interaction.
  3. The onAdSkip, onAdCountdownToZero callbacks empty appOpenAd and call the request ad method to load ads in advance for quick start.
AppOpenAdInteractionListener Instruction

AppOpenAdInteractionListener

callback

Description

onAdShow()

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.

onAdSkip()

This method is called when the user clicks the skip button.

onAdCountdownToZero()

Ad countdown ends

Show Ad

Call the showAppOpenAd() method to render the ad and it needs to pass in activity.

Note:

  1. App Open Ads fill the entire screen by default.
  2. App Open ad timeout recommended >=3000ms.
  3. An interactive listener (AppOpenAdInteractionListener), which must be handled before the showAppOpenAd() method is called. If you don't call the showAppOpenAd() method, you don't need to set up a listener for the interaction.
  4. The onAdSkip, onAdCountdownToZero callbacks empty appOpenAd and call the request ad method to load ads in advance for quick start.


Refer to the Demo example

For a specific example of loading APP Open Ads, see AppOpenAdActivityPangleAppOpenAdManager in Demo.


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 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.