# 插屏广告

<div align="left"><figure><img src="/files/o15YcPxnCr0qk2hmepVV" alt=""><figcaption></figcaption></figure></div>

插屏广告是一种默认展示在用户屏幕全屏的广告形式，广告展示过程中，用户可进行点击，访问广告网页地址，或者进行跳过等相关操作，通常适用于关键操作触发引导用户观看内容，例如当用户在进行视频播放暂停或游戏过关时进行展示，本指南将介绍如何集成广告到应用中

## 前提

用户完成广告初始化步骤[入门指南](/copy-of-cn/jie-kou-wen-dang/android/kai-shi/ru-men-zhi-nan.md)

## 初始化

{% hint style="info" %}
请在用户需要进行展示插屏广告时进行初始化操作，当前广告为即时展示
{% endhint %}

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

## 设置广告窗体方向

```java
view.setOpt(0); 
```

{% hint style="warning" %}
`0`-垂直 `1`-横向，广告位方向默认为垂直，用户可根据具体业务进行配置，用户可跳过当前操作
{% endhint %}

## 广告事件监听设置

```java
 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
            }
        });
```

事件监听描述参考[横幅广告](/copy-of-cn/jie-kou-wen-dang/android/guang-gao-ge-shi/heng-fu-guang-gao.md#cao-zuo-hui-tiao-fang-fa-miao-shu-yu-jie-shao)

## 广告加载

执行load方法后，广告自动加载填充到页面展示给用户，填充方式为全屏覆盖

```java
view.loadAd();
```

{% hint style="info" %}
插屏广告加载完成后，广告位自带广告相关操作模块，用户可手动进行广告位点击，音量控制与广告播放状态控制等，开发者可根据回调状态完成自身逻辑
{% endhint %}

## 完整实例

```java
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();
    }
}
```

广告加载完成后，广告位会根据广告配置完成定时广告播放，播放完成或用户跳过后自动完成回收与关闭，用户不需要做相关操作


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.adx3.io/copy-of-cn/jie-kou-wen-dang/android/guang-gao-ge-shi/cha-ping-guang-gao.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
