The fully automatic loading mode is a one-stop request maintenance solution launched by TopOn. It can intelligently determine the preloading and caching timing of the next advertisement based on the user's usage status and ad consumption progress with multiple nodes. On the basis of satisfying the developer's operation strategy, it avoids the risk of failure in real-time loading of advertising data and wasted display opportunities, and alleviates users' negative emotions caused by ads not loading or loading not smoothly. Through fully automatic loading of solutions, developers can avoid repeated and cumbersome manual intervention request solutions, and efficiency improvements are immediate.
Note: If the advertising space is set to fully automatic loading, Don't call ATInterstitialAd#loadInterstitialAd (Normal interstitial ad) for advertising Loading
ATInterstitialAutoAd:
API | Parameters | Description |
---|---|---|
addAutoLoadAdPlacementID | string[] placementIDList | Set ad slots that need to be loaded automatically |
removeAutoLoadAdPlacementID | string placementId | Remove ad slots that do not require automatic loading |
setAutoLocalExtra | string placementId, string mapJson | Set additional parameters for the ad slot |
setListener | ATRewardedVideoListener listener | (Abandoned after version 5.9.51) For details on how to set up a listener, please refer to: Insert screen Ad event setting instructions** |
autoLoadInterstitialAdReadyForPlacementID | string placementid | Determine whether there is an ad cache |
showAutoAd | string mapJson | show ads |
showAutoAd | string placementid, Dictionary<string,string> extra | Use scene function to display ads more |
entryAutoAdScenarioWithPlacementID | string placementid, string scenarioID | Set to enter the displayable advertising scenario |
Use the following code to set up fully automatic loading of interstitial ads:
public void addAutoLoadAdPlacementID()
{
ATInterstitialAutoAd.Instance.client.onAdLoadEvent += onAdLoad;
ATInterstitialAutoAd.Instance.client.onAdLoadFailureEvent += onAdLoadFail;
ATInterstitialAutoAd.Instance.client.onAdShowEvent += onShow;
ATInterstitialAutoAd.Instance.client.onAdClickEvent += onAdClick;
ATInterstitialAutoAd.Instance.client.onAdCloseEvent += onAdClose;
ATInterstitialAutoAd.Instance.client.onAdShowFailureEvent += onAdShowFail;
ATInterstitialAutoAd.Instance.client.onAdVideoStartEvent += startVideoPlayback;
ATInterstitialAutoAd.Instance.client.onAdVideoEndEvent += endVideoPlayback;
ATInterstitialAutoAd.Instance.client.onAdVideoFailureEvent += failVideoPlayback;
string[] jsonList = {mPlacementId_interstitial_all};
ATInterstitialAutoAd.Instance.addAutoLoadAdPlacementID(jsonList);
}
bool isReady = ATInterstitialAutoAd.Instance.autoLoadInterstitialAdReadyForPlacementID(mPlacementId_interstitial_all);
public void showAutoAd()
{
ATInterstitialAutoAd.Instance.showAutoAd(mPlacementId_interstitial_all);
}
When using the Scene function:
public void showAutoAd()
{
//Set up the scene
ATInterstitialAutoAd.Instance.entryAutoAdScenarioWithPlacementID(mPlacementId_interstitial_all, showingScenario);
Dictionary<string, string> jsonmap = new Dictionary<string, string>();
jsonmap.Add(AnyThinkAds.Api.ATConst.SCENARIO, showingScenario);
ATInterstitialAutoAd.Instance.showAutoAd(mPlacementId_interstitial_all,jsonmap);
}
Please see the callback information details: Callback information description
Use the following code to implement multiple listeners
//Advertisement loaded successfully
ATRewardedAutoVideo.Instance.client.onAdLoadEvent += onAdLoad;
//Ad loading failed
ATRewardedAutoVideo.Instance.client.onAdLoadFailureEvent += onAdLoadFail;
//Ad display callback (you can rely on this callback to count display data)
ATRewardedAutoVideo.Instance.client.onAdVideoStartEvent += onAdVideoStartEvent;
//Advertisement ends
ATRewardedAutoVideo.Instance.client.onAdVideoEndEvent += onAdVideoEndEvent;
//Advertisement video playback failed
ATRewardedAutoVideo.Instance.client.onAdVideoFailureEvent += onAdVideoPlayFail;
//ad click
ATRewardedAutoVideo.Instance.client.onAdClickEvent += onAdClick;
//Advertising incentive callback (you can rely on this listener to issue game incentives)
ATRewardedAutoVideo.Instance.client.onRewardEvent += onReward;
//广告被关闭
ATRewardedAutoVideo.Instance.client.onAdVideoCloseEvent += onAdVideoClosedEvent;
The method definition parameters are as follows (Note: The method name can Refer to the following code or customize the method name, but the parameters must be consistent)
//sender is the advertising type object, erg is the return information
//Advertisement loaded successfully
public void onAdLoad(object sender,ATAdEventArgs erg)
{
Debug.Log("Developer callback onInterstitialAdLoad :" + erg.placementId);
}
//Ad loading failed
public void onAdLoadFail(object sender,ATAdErrorEventArgs erg )
{
Debug.Log("Developer callback onInterstitialAdLoadFail :" + erg.placementId + "--erg.code:" + code + "--msg:" + erg.message);
}
//Advertisement displayed successfully
public void onShow(object sender,ATAdEventArgs erg)
{
Debug.Log("Developer callback onInterstitialAdShow :" +erg. placementId);
}
//ad clicked
public void onAdClick(object sender,ATAdEventArgs erg)
{
Debug.Log("Developer callback onInterstitialAdClick :" + erg.placementId);
}
//Ads are turned off
public void onAdClose(object sender,ATAdEventArgs erg)
{
Debug.Log("Developer callback onInterstitialAdClose :" + erg.placementId);
}
//The advertising video starts playing. Some platforms have this callback.
public void startVideoPlayback(object sender,ATAdEventArgs erg)
{
Debug.Log("Developer callback onInterstitialAdStartPlayingVideo :" + erg.placementId);
}
//The advertising video ends. Some advertising platforms have this callback.
public void endVideoPlayback(object sender,ATAdEventArgs erg)
{
Debug.Log("Developer callback onInterstitialAdEndPlayingVideo :" + erg.placementId);
}
//Ad video playback failed, some advertising platforms have this callback
public void failVideoPlayback(object sender,ATAdEventArgs erg)
{
Debug.Log("Developer callback onInterstitialAdFailedToPlayVideo :" + erg.placementId + "--code:" + erg.code + "--msg:" + erg.message);
}