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

Native

Introduction

Native ads refer to a form of advertising that allows for customization of the ad's appearance, seamlessly blending it with the app's design to provide a natural and engaging experience for users. With native ads, you have the creative freedom to design the ad's layout, look and feel, and placement within your app, thereby enabling you to achieve a cohesive and integrated advertising experience.

It's important to note that Pangle currently supports four different native ad formats outside of the Chinese Mainland, including a large image with a 1.91:1 ratio, 1280*720 video, square image, and square video. As a developer, it's essential to ensure that the native ad format and size comply with Pangle's specific requirements to ensure optimal ad performance and user experience.

Precondition

Create an app and native ad placement on the Pangle platform

Native Ads Implementation

Native ads are ad assets that are presented to users via UI components. It can be formatted to match your app's visual design. When a native ad loads, your app receives an ad object that contains its assets, and the app is then responsible for displaying them.

Broadly speaking, there are three steps to successfully implement Native Ads:

  • Create PAGNativeRequest object
  • Load a Native ad and register PAGNativeAdLoadListener callback
  • Design your native ad layout.
  • Register PAGNativeAdInteractionListener callback
  • Display the ad.

Create PAGNativeRequest object

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

Create the PANativeAd object and register callback

The description of PAGNativeAdLoadListener

PAGNativeAdLoadListener

Description

OnLoadFailed

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.

OnLoad


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 PAGNativeAdInteractionListener callback

PAGNativeAdInteractionListener

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.

Show Ad

An instance of the PAGNativeAd 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 into activity.

Destroy Ad

Destroy advertisements in time to avoid memory leaks.

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.