Interstitial

An interstitial ad is a form of advertisement that is displayed on the full screen of the user's screen by default. During the display of the advertisement, the user can click, visit the advertisement webpage address, or perform related operations such as skipping. It is usually suitable for key operations to trigger and guide users to watch the content. For example, when the user pauses the video or the game is displayed, this guide will introduce how to integrate the advertisement into the application.

Before you begin

You should finish the step of the Guide first.

Initialization

Please perform initialization when the user needs to display an interstitial ad, the current ad is displayed immediately.

Adx3InsertAdView view = new Adx3InsertAdView(this,"UnitId");

Set ad form orientation

view.setOpt(0);

0-vertical 1-horizontal, the default orientation of the ad slot is vertical. The user can configure it according to the specific business and skip the current operation.

Advertising event monitoring settings

view.setListener(new AdListener() {
            @Override
          public void show() {
            //Code to be executed when the ad has been showed int Screen
            }

            @Override
            public void loadFaild() {
            //Code to be executed when the ad load faild
            }

            @Override
            public void loadSucces() {
            //Code to be executed when the ad load success
            }

            @Override
            public void adClose() {
            //Code to be executed when the ad close by user
            }

            @Override
            public void adClick() {
            //Code to be executed when user click the ad
            }

            @Override
            public void adComplate() {
             //Code to be executed when the ad is finish   
            }

            @Override
            public void adSkip() {
            //Code to be executed when user skip the ad not wait for finish it
            }

            @Override
            public void clickUrl(String url) {
            //Code to be executed when user click the ad and tell the url to uesr
            }
        });

Event listener description reference

LoadAd

After executing the load method, the ad is automatically loaded and filled to the page for display to the user, and the filling method is full-screen coverage.

view.loadAd();

After the interstitial ad is loaded, the ad slot comes with an ad-related operation module. Users can manually click on the ad slot, control the volume, and control the ad playback status. Developers can complete their own logic according to the callback status.

Full example

public class MainActivity extends AppCompatActivity {
    Adx3InsertAdView view;

    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        
        //TODO use Create to Add AdView
        view = new Adx3InsertAdView(getContext(),"UnitId");
        
        //TODO load the AD
        view.loadAd();
    }
}

After the ad is loaded, the ad slot will complete the scheduled ad playback according to the ad configuration, and automatically complete recycling and closing after the playback is completed or the user skips it, and the user does not need to do related operations.

Last updated