What is an interstitial AD?

An interstitial AD is a full-screen AD that pops up when an app starts, pauses, or exits. When the app displays the interstitials, the user can either choose to click on the AD and go to the site they are targeting, or close it and return to the app.

Advantages of screen interstitials

Interstitials display larger size, better visual effect; Compared with Banner ads, interstand ads are easier to focus the eyes of users and have higher click-through rates and conversion rates. Compared to news stream advertising, it has a weaker fit with the app, but more attention and exposure effect.

Interstand ads are displayed when the application pauses, jumps and exits, and the display timing cleverly avoids the influence of users on the normal experience of the application. Interstitial ads can achieve the best results if they can accurately recommend the ads that users are interested in, and if the ads are well coordinated with the application.

Huawei’s AD service allows developers to access six types of AD space, including interstitials. The next article will go through the steps of developing interstitials in detail. The sample code has been open source in relevant communities, developers are welcome to pay attention to, download and provide valuable comments:

GitHub’s official address: https://github.com/hms-core/h…

Gitee’s official address: https://gitee.com/hms-core/hm…

The premise condition

Huawei ADS SDK relies on HMS Core (APK) version 4.0.0.300 and above. If version 4.0.0.300 or above of HMS Core (APK) is not installed on the device, the relevant interface of HUAWEI ADS SDK cannot be used.

Before developing the application, you need to register as a developer on the website of Huawei Developer Union and complete the real-name authentication. Please refer to the account registration authentication for specific methods.

See Creating a project and adding an application to a project to complete the creation of the application.

Pre-development preparation

The integration of advertising services requires the following four key steps, which can be referred to the Huawei Developer Alliance documentation

  1. Import HUAWEI ADS SDK
  1. Configure network permissions
  1. Configure Obfuscation Script
  1. To initialize the SDK

Key development steps

1.1 Create interstitial advertising objects.

Create the InterstitialAd object and set the test AD spot ID through the setaId () method of the InterstitialAd class.

private InterstitialAd interstitialAd; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_interstitial); interstitialAd = new InterstitialAd(this); // "testb4znbuh3n2" is the AD space ID for testing. When the App is officially released, it needs to change to the official AD space ID interstitialad. setAdId("testb4znbuh3n2"); loadInterstitialAd(); }

1.2 Acquisition of advertising.

Call the loadAd() method of the InterstitialAd object to get the AD.

private void loadInterstitialAd() { ... // AdParam = new AdParam.Builder().build(); interstitialAd.loadAd(adParam); . }

1.3 Display advertising.

Call the show(Activity Activity) method of Interstitialad to display the AD, before calling the isLoaded() method to confirm that the AD has been loaded.

Private void showInterstitialAd() {if (InterstitialAd! = null && interstitialAd.isLoaded()) { interstitialAd.show(this); } else { Toast.makeText(this, "Ad did not load", Toast.LENGTH_SHORT).show(); }}

1.4 Monitoring advertising events.

Call the setAdListener method of the InterstitialAd class to add an AD event listener to the InterstitialAd object and listen for AD events by implementing methods in the AdListener class. For detailed methods, see the AdListener class in the API documentation.

. interstitialAd.setAdListener(adListener); . Private addListener addListener = new addListener () {@Override public void onadLoaded () {// Override public void onadLoaded () {// Override public void onadLoaded () {// Override public void onadLoaded () { showInterstitialAd(); } @Override public void onadFailed (int errorCode) {// Override public void onadFailed (int errorCode) { } public void OnAdClosed () {// Override public void OnAdClosed () { } @override public void onadClicked () {// Call when an AD is clicked... } public void onAdLeave() {// Override public void onAdLeave() { } @Override public void onAdopened () {// Call when the AD is open... } @Override public void OnadimExpression () {// Invoking... }};

More in-app advertising how-to guidelines:

1. Add Banner advertising space in the app

2. Add in-app motivational ads

3. Add native ads in your app

4. Add screen ads in the app

5. Add in-app interstitials

6. Add patch ads in the app

Visit Huawei’s official website for more information

Obtain Huawei Advertising Service Development Guidance Document

Visit the Huawei Developer Alliance website to learn more about it

Get the development guidance document

Address of Huawei Mobile Service Open Source Warehouse: GitHub and Gitee

The original link: https://developer.huawei.com/… Author: Pepper