Help Center/Details/

Splash Ads

Introduction

Splash ad: The Splash advertisement is a full-screen advertisement displayed when the user enters the App. The Splash advertisement is a View, and the width and height are match_parent by default.
Attention: Splash advertising view: width = screen width; height needs to be >=75% screen height, otherwise it will affect billing.
Supported ad size: The size of the Splash ad is the size set when the developer requests the ad. It is recommended that the requested size be set to be consistent with the size of the display area to avoid material distortion.

Authority

SDK rendering on-screen ads: Provided by default
Template rendering on-screen advertisement: Whitelist, need to apply for activation

Request method
Remarks:There is no difference in the request method between the template rendering screen and the SDK rendering the screen advertisement, only the difference in the request parameters.
The setExpressViewAcceptedSize parameter needs to be set in the screen opening request method of template rendering, and this parameter is not required to be set when the SDK renders the screen opening advertisement.
Create TTAdNative object

//创建TTAdNative对象,createAdNative(Context context) context需要传入Activity对象
TTAdNative mTTAdNative = TTAdSdk.getAdManager().createAdNative(this);

Create ad request AdSlot
SDK rendering on screen

AdSlot adSlot = new AdSlot.Builder()
        .setCodeId(mCodeId)
        .setImageAcceptedSize(1080, 1920)
        .build();

Template rendering on screen

AdSlot adSlot = new AdSlot.Builder()
        .setCodeId(mCodeId)
        //模板广告需要设置期望个性化模板广告的大小,单位dp,代码位是否属于个性化模板广告,请在穿山甲平台查看。且仅是模板渲染的代码位ID使用,非模板渲染代码位切勿使用
        .setExpressViewAcceptedSize(expressViewWidth, expressViewHeight)
        .build();

Parameter description

Parameter Meaning
setCodeId() The code ID created by the platform starts with 8 and 9 digits
setImageAcceptedSize() Set the dimensions for requesting non-template creatives. Unit: px SDK rendering needs to be set
setExpressViewAcceptedSize() Set the size of the request template creative. Unit: dp template rendering needs to be set

TTSplashAd advertising interface description

public interface TTSplashAd {

  /**
   * 得到开屏广告
   *
   * @return
   */
  @NonNull
  View getSplashView();

  /**
   * 得到Splash广告的交互类型
   *
   * @return 2在浏览器内打开 (普通类型)3落地页(普通类型),5:拨打电话 -1 未知类型
   */
  int getInteractionType();

  /**
   * 注册Splash广告交互回调
   *
   * @param listener 监听器
   */
  void setSplashInteractionListener(AdInteractionListener listener);

  interface AdInteractionListener {
      /**
       * Splash广告的点击回调
       *
       * @param view Splash广告
       * @param type Splash广告的交互类型
       */
      void onAdClicked(View view, int type);

      /**
       * Splash广告的展示回调
       *
       * @param view Splash广告
       * @param type Splash广告的交互类型
       */
      void onAdShow(View view, int type);

      /**
       * 点击跳过时回调
       */
      void onAdSkip();

      /**
       * 广告播放时间结束
       */
      void onAdTimeOver();
  }
}

Request ad

Call TTAdNative.loadSplashAd(AdSlot adSlot, SplashAdListener listener, int timeOut) to load the splash ads asynchronously.
adslot is the information for requesting advertisements, SplashAdListener is the callback for the success or failure of advertisement loading, and timeOut is the maximum time allowed to load the Splash advertisement (Note: recommended timeOut> 3500ms). The calling example is as follows:

mTTAdNative.loadSplashAd(adSlot, new TTAdNative.SplashAdListener() {
        //请求广告失败
    @Override
    @MainThread
    public void onError(int code, String message) {
        //开发者处理跳转到APP主页面逻辑
    }

        //请求广告超时
    @Override
    @MainThread
    public void onTimeout() {
        //开发者处理跳转到APP主页面逻辑
    }

        //请求广告成功
    @Override
    @MainThread
    public void onSplashAdLoad(TTSplashAd ad) {
        if (ad == null) {
            return;
        }
        //获取SplashView
        View view = ad.getSplashView();
        if (view != null && mSplashContainer != null && !SplashActivity.this.isFinishing()) {
            mSplashContainer.removeAllViews();
            //把SplashView 添加到ViewGroup中,注意开屏广告view:width =屏幕宽;height >=75%屏幕高
            mSplashContainer.addView(view);
            //设置不开启开屏广告倒计时功能以及不显示跳过按钮,如果这么设置,您需要自定义倒计时逻辑
            //ad.setNotAllowSdkCountdown();
        }else {
            //开发者处理跳转到APP主页面逻辑
        }
    }
}, AD_TIME_OUT);

Attention: Call ad.getSplashView() to get SplashView
SplashAdListener Description

Callback Description
onError() Advertisement request failed callback The returned error code (code) indicates the reason why the advertisement request failed,See the link for details
onTimeout() Splash ad loading timeout callback
onSplashAdLoad() The callback when the advertisement is loaded, the access party can display in this callback

Advertising interaction listener

ad.setSplashInteractionListener(new TTSplashAd.AdInteractionListener() {

        //点击回调
    @Override
    public void onAdClicked(View view, int type) {

    }
    
        //展示回调
    @Override
    public void onAdShow(View view, int type) {

    }
    
        //跳过回调
    @Override
    public void onAdSkip() {
      //开发者处理跳转到APP主页面逻辑
    }
    
        //超时倒计时结束
    @Override
    public void onAdTimeOver() {
       //开发者处理跳转到APP主页面逻辑
    }
});

AdInteractionListener Description

Callback Description
onAdClicked() Ad click callback
onAdShow() Ad display callback
onAdSkip() Ad skip callback
onAdTimeOver() Countdown to the end of the advertisement callback

Splash Finishing touch

Description
The screen finishing style needs to be used with the platform, and the developer needs to check the screen finishing style on the CSJ platform before the client can get the finishing budget.
22222.png

  • SDK version requirements: CSJ 3600 and above.
  • Supported types of screen finishing: pictures, videos
  • The interactive way of opening the screen and finishing touch: During the 5s opening display process, the user clicks "skip" in the upper right corner or after the 5s exposure is over, the opening image or video will shrink to the small window in the lower right corner of the APP to continue displaying.

Access code example:
There are two types of finishing examples in the demo of CSJ 3600 and above:

  • The first type is the opening screen finishing animation displayed on the opening screen activity, which is suitable for the scene where the main interface and the opening screen are in the same activity.
  • -The second is the screen opening and finishing animation displayed on the main interface Activity, which is suitable for scenes where the main interface and the screen opening are in different activities.
    For specific sample codes, please check SplashActivity, SplashClickEyeManager (mainly used to realize the opening and finishing animation management class)
    Main API:
  • 3 new interfaces have been added to the CSJ TTSplashAd to support screen opening:
Method name Method introduction
splashClickEyeAnimationFinish() This method requires the developer to actively call and notify the CSJ to change the logic of the dotting view at the end of the dotting animation
setSplashClickEyeListener(ISplashClickEyeListener listener) By passing the monitor to the CSJ, the CSJ will trigger each interface method of ISplashClickEyeListener at the right time to notify the developer to do different operations.
int[] getSplashClickEyeSizeToDp() The recommended size of the finishing view passed by the CSJ to the developer. It is recommended that the developer use this value to determine the size of the final finishing view.
  • Newly added ISplashClickEyeListener interface for CSJ:
Method name Method introduction
onSplashClickEyeAnimationStart() For version 3600 and later, it is triggered when the CSJ meets the conditions for opening the screen, and the developer can start to show the eye-catching animation in this callback.
onSplashClickEyeAnimationFinish() In version 3600 and later, it is triggered when the CSJ closes the dotting view. Developers can do some resource recovery in this method and close the screen opening operation.
isSupportSplashClickEye(boolean isSupport) In version 3600 and later, it is triggered when the CSJ meets the conditions for opening and finishing. Developers can maintain the boolean value in this method, which is used when the two activities of the opening screen determine whether they need to show the opening and finishing.

The AnimationCallBack interface for opening the screen and finishing animation is added to the Demo:

Method name Method introduction
animationStart(int animationTime) Called when starting to execute the opening and finishing animation, animationTime is the execution time of the finishing animation, which can be defined by the developer.
animationEnd() Called after finishing the finishing animation

Method introduction
In the callback of successful onSplashAdLoad advertisement pull when the screen is opened, the related methods for initializing the screen opening are:
initSplashClickEyeData, this method mainly does two things:

  • The first thing is to instantiate the ISplashClickEyeListener interface and set the ISplashClickEyeListener instance object to the CSJ.
  • The second thing is to keep the current TTSplashAd and opening view to the SplashClickEyeManager singleton method as setSplashInfo.
    This method is used to transfer the screen opening animation data between two activities.
    Remove ad view
    The ad view on the ad control can be removed when the activity jumps to other activities
    mSplashContainer.removeAllViews();
    Reference Demo
    For specific examples of loading the open screen advertisement, see SplashActivity in Demo

Points to note when Splash ads:

1、The screen opening request method of template rendering needs to set the setExpressViewAcceptedSize parameter unit dp. The non-template rendering opening request method needs to set the setImageAcceptedSize parameter in px. Remember not to use errors
2、It is recommended that the loading timeout time of the Splash advertisement be greater than 3500ms, to ensure the display rate of the advertisement to the greatest extent, and the Splash experience, the example is set to 3500ms
3、In order to maximize revenue, all Splash advertisements must be requested in real time and cannot be cached.
4、Developers should do the process of jumping to the main page when onError(), onTimeout(), onAdSkip(), onAdTimeOver() callbacks and TTSplashAd ads are null, and remove the view on the Splash control after the jump.
5、The developer needs to make a mark in onStop() in the opening activity. Do the logic processing of jumping to the main page in onResume(). After the jump, the view on the opening control is removed.

@Override
protected void onResume() {
    //判断是否该跳转到主页面
    if (mForceGoMain) {
        goToMainActivity();
    }
    super.onResume();
}

@Override
protected void onStop() {
    super.onStop();
    mForceGoMain = true;
}

6、If you want to add your own logo at the bottom, you need to reduce the display area of the Splash advertisement. At this time, when requesting the width and height, fill in the cropped width and height, that is, the requested size is screen width* (screen height-logo height)
7、Custom skip button, use the dotting function description, see

https://www.pangle.cn/support/doc/6109033c7d600700463e0b26

Did the content solve your problem?
Contact us