Menu

Fully automatic loading

💡Tips

  • The fully automatic loading mode is a one-stop request maintenance solution launched by TopOn. It can intelligently determine the timing for preloading and caching the next ad at multiple nodes based on the user's usage status and the progress of ad consumption. While adhering to your operational strategies, it avoids the risks of real-time ad data loading failures and wasted display opportunities, reducing the negative impact on users due to ads not loading or loading smoothly. With the fully automatic loading solution, you can avoid repetitive and cumbersome manual intervention in the request process, resulting in immediately noticeable efficiency improvements.

 

● Rewarded Ads

1. Integrate Tips

● Loading Ads

  • Please initialize the fully automatic rewarded ads on the homepage
  • The context passed to ATRewardVideoAutoAd#init() must be an Activity

● Showing Ads

  • Please do not show ads within the onRewardVideoAutoLoaded()

● S2S Rewarded Callbacks

  • Fully automatic loading of rewarded ads supports server-to-server (S2S) rewards. For more details, please refer to S2S Rewarded Callbacks.

 

2. Load a Rewarded Ad

//--------------------- Number 1 start -------------------------
// During initialization, input the ad placementId, supporting one to multiple placementId
String[] placementIdArr = new String[]{"your placementId_1 ", "your placementId_2"};
// If you need to set up S2S callback localExtra info, be sure to do so before ATRewardVideoAutoAd.init()
setPlacementIdLocalExtra(placementIdArr);
ATRewardVideoAutoAd.init(activity, placementIdArr, new ATRewardVideoAutoLoadListener() {
    @Override
    public void onRewardVideoAutoLoaded(String placementId) {}

    @Override
    public void onRewardVideoAutoLoadFail(String placementId, AdError adError) {}
});
//--------------------- Number 1 end -------------------------

//--------------------- Number 2 start -------------------------
// First, initialize, and then input the ad placementId, supporting one to multiple placementId
String[] placementIdArr = new String[]{"your placementId_1 ", "your placementId_2"};
// If you need to set up S2S callback localExtra info, be sure to do so before ATRewardVideoAutoAd.init()
setPlacementIdLocalExtra(placementIdArr);
ATRewardVideoAutoAd.init(activity, null, new ATRewardVideoAutoLoadListener() {
    @Override
    public void onRewardVideoAutoLoaded(String placementId) {}
    @Override
    public void onRewardVideoAutoLoadFail(String placementId, AdError adError) {}
});
// addPlacementId() must be called after ATRewardVideoAutoAd.init()
ATRewardVideoAutoAd.addPlacementId(placementIdArr);
//--------------------- Number 2 end -------------------------

// Set S2S callback localExtra info
private void setPlacementIdLocalExtra(String... placementIdArr) {
    for (String placementId : placementIdArr) {
        String userid = "test_userid_001";
        String userdata = "test_userdata_001";
        Map localMap = new HashMap<>();
        localMap.put(ATAdConst.KEY.USER_ID, userid);
        localMap.put(ATAdConst.KEY.USER_CUSTOM_DATA, userdata);
        // Effective from the next ad load
        ATRewardVideoAutoAd.setLocalExtra(placementId, localMap);
    }
}

⚠️Note

  • If the ad placementId is the same, both init()andaddPlacementId()only need to be called once.

 

3. Show a Rewarded Ad

ATRewardVideoAutoAd.show(activity, "your placement id", new ATRewardVideoAutoEventListener() {
    @Override
    public void onRewardedVideoAdPlayStart(ATAdInfo adInfo) {}
    
    @Override
    public void onRewardedVideoAdPlayEnd(ATAdInfo adInfo) {}
    
    @Override
    public void onRewardedVideoAdPlayFailed(AdError adError, ATAdInfo adInfo) {}
    
    @Override
    public void onRewardedVideoAdClosed(ATAdInfo adInfo) {}
    
    @Override
    public void onRewardedVideoAdPlayClicked(ATAdInfo adInfo) {}
    
    @Override
    public void onReward(ATAdInfo adInfo) {}
});

 

● Interstitial Ads

1. Integrate Tips

● Loading Ads

  • Please initialize the fully automatic interstitial ads on the homepage
  • The context passed to ATInterstitialAutoAd#init() must be an Activity

● Showing Ads

  • Please do not show ads within the onInterstitialAutoLoaded()

 

2. Load an Interstitial Ad

//--------------------- Number 1 start -------------------------
// During initialization, input the ad placementId, supporting one to multiple placementId
String[] placementIdArr = new String[]{"your placementId_1 ", "your placementId_2"};
ATInterstitialAutoAd.init(activity, placementIdArr, new ATInterstitialAutoLoadListener() {
    @Override
    public void onInterstitialAutoLoaded(String placementId) {}

    @Override
    public void onInterstitialAutoLoadFail(String placementId, AdError adError) {}
});
//--------------------- Number 1 end -------------------------

//--------------------- Number 2 start -------------------------
// First, initialize, and then input the ad placementId, supporting one to multiple placementId
String[] placementIdArr = new String[]{"your placementId_1 ", "your placementId_2"};
ATInterstitialAutoAd.init(activity, null, new ATInterstitialAutoLoadListener() {
    @Override
    public void onInterstitialAutoLoaded(String placementId) {}

    @Override
    public void onInterstitialAutoLoadFail(String placementId, AdError adError) {}
});
// addPlacementId() must be called after ATInterstitialAutoAd.init()
ATInterstitialAutoAd.addPlacementId(placementIdArr);
//--------------------- Number 2 end -------------------------

⚠️Note

  • If the ad placementId is the same, both init()andaddPlacementId()only need to be called once.

 

3. Show an Interstitial Ad

ATInterstitialAutoAd.show(activity, "your placement id", new ATInterstitialAutoEventListener() {
    @Override
    public void onInterstitialAdShow(ATAdInfo adInfo) {}
                
    @Override
    public void onInterstitialAdVideoStart(ATAdInfo adInfo) {}
                
    @Override
    public void onInterstitialAdVideoEnd(ATAdInfo adInfo) {}
                
    @Override
    public void onInterstitialAdVideoError(AdError adError) {}
                
    @Override
    public void onInterstitialAdClose(ATAdInfo adInfo) {}
                
    @Override
    public void onInterstitialAdClicked(ATAdInfo adInfo) {}
});
Previous
Advanced
Next
Custom Network
Last modified: 2025-06-20Powered by