穿山甲-全球开发者成长平台|接入文档
知识中心
本文尚无当前语言版本,相关翻译工作正在进行中,感谢您的理解!

App Open Ads

💡 Pangle SDK version 4300 and above supports App Open Ads. This document is intended for developers utilizing Pangle SDK directly. If Pangle integration is mediated, please refer to the relevant section.

Introduction

App Open Ads constitute a distinctive ad format that caters to publishers seeking to monetize their app load screens. These ads are strategically positioned to be exhibited when your users switch to your app and may be terminated at any point.

Precondition

Create an app and App Open ad placement on the Pangle platform

App Open Ads Implementation

The main steps to integrate App Open ads are:

  1. Set Host APPIcon
  1. Create PAGOpenRequest object
  1. Load an ad
  1. register PAGLAppOpenAdDelegate callback
  1. Show the ad

Set Host APPIcon

set the host app icon when initializing the Pangle SDK.

Tips: Please follow the code below to set the appLogoImage , otherwise, the logo image won't be displayed in the App open ad.

Load an ad

Loading an ad is accomplished using the loadAdWithSlotID: request: completionHandler:() method in the PAGLAppOpenAd class. The method requires an ad slot id, an instance object of PAGOpenRequest , and a completionHandler to be notified when ad loading succeeds or fails. The loaded PAGLAppOpenAd object is provided as a parameter in the success callback.

Create PAGOpenRequest object

PAGOpenRequest is an Ad Loading Manager. It is recommended to be the member variable of the Activity. This class can configure the load timeout period.

Load an ad and Register completionHandler callback

Use the method of PAGLAppOpenAd to load the ad, and register the completionHandler callback.

The description of callback

callback

description

error

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

appOpenAd

This object is returned when an ad material is loaded successfully.

Register PAGLAppOpenAdDelegate 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 PAGLAppOpenAdDelegate callback

PAGLAppOpenAdDelegate

description

- (void)adDidShow:(PAGLAppOpenAd *)ad

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

- (void)adDidClick:(PAGLAppOpenAd *)ad

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

- (void)adDidDismiss:(PAGLAppOpenAd *)ad

This method is invoked when the ad disappears.

Show Ad

An instance of the PAGLAppOpenAd object will be returned when the ad is loaded successfully. Call the presentFromRootViewController: method of PAGLAppOpenAd to show the ad.

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 the Pangle platform.