Manual loading mode can satisfy developers who need flexible access.
Note: The SDK will not hold advertising instances( ATInterstitial) and callback instance (ATInterstitialListener), so developers need to ensure that the advertising instance will not be recycled before the advertising ends to avoid callback loss
1.Loading ads:
2.Display ads:
3.Ad preloading:< /p>
After the interstitial ad is displayed, there is no need in the callback of onInterstitialAdShow or onInterstitialAdClose isAdReadyjudgment, directly call load for preloading (helps to increase the display volume of higher priority advertising sources)
You can refer to Automatically request ads to enable automatic request for ads (if preloading after display above is implemented, there is no need to enable it)
; It is recommended to use a fully automatic request scheme. For details, see the fully automatic loading mode description
It is recommended to configure a preset strategy: improve the ad loading effect of the first cold start , for detailed instructions and access tutorials, see SDK preset strategy usage instructions
ATInterstitial: Loading class for Interstitial ads
Method | Parameters | Description |
---|---|---|
ATInterstitial | ( Context context, String interstitialTakuPlacementID) | Interstitial advertising initialization method, where interstitialTakuPlacementID is created through the Taku background Interstitial advertising spaceobtained. context: If the following platforms are integrated: gdt、sigmob、Baidu, ironSource, Kidoz, Maio, Tabjoy, context must be Activity |
setLocalExtra | (Map | Set local parameters |
load | Initiate ad loading | |
load | (Context context)< /td> | Initiates ad loading. Developers can use the specified Context to load ads by calling this method |
Ad loading:
//Note: The advertising object must be globally referenced. If the advertising object is a temporary variable, it may be reclaimed during the advertising loading process and unable to receive advertising event callbacks
ATInterstitial mInterstitialAd;
private void loadAd() {
if (mInterstitialAd == null) {
mInterstitialAd = new ATInterstitial(this, interstitialTakuPlacementID);
}
mInterstitialAd.load();
}
ATInterstitial:
Method | Parameters | Description |
---|---|---|
checkAdStatus | - | Get the status object ATAdStatusInfo of the current advertising slot. The API description of the ATAdStatusInfo object is shown below |
checkValidAdCaches | - | Query the ATAdInfo object ATAdInfo for all cached information of the current advertising slot : The information object of the advertisement can distinguish the advertising platform, mainly including the id information of the third-party aggregation platform See ATAdInfo information description |
ATAdStatusInfo: The status object of the advertising slot
Method | Parameter | Description |
---|---|---|
isLoading | - | Determine whether the current ad slot is loading ads |
isReady | Determine whether there are ads that can be displayed in the current ad slot , the same as the ATInterstitial.isAdReady() method | |
getATTopAdInfo | - | Get the ad cache information ATAdInfo object ATAdInfo with the highest priority in the current ad slot: The information object of the advertisement can distinguish the advertising platform, and mainly includes the id information of the third-party aggregation platform See ATAdInfo information description |
ATInterstitial:
Method | Parameters | Description |
---|---|---|
isAdReady | - | Determine whether there are ads that can be displayed in the current Interstitial |
show | ( Activity activity) | Display Interstitial ads (recommended) |
(Deprecated since v6.3.10) Display Interstitial ads. The scenario refers to the advertising display scene, and the scene parameters can be created from the background. Please refer to Advertising scene | ||
show | (Activity activity, ATShowConfig showConfig) | (v6.3.10+) Display Interstitial ads. showConfig: You can pass in additional parameters during display, as follows 1.ATShowConfig#showCustomExt(String showCustomExt): You can pass in custom parameters during display, and the parameters passed in will be returned through ATAdInfo#getShowCustomExt() 2.ATShowConfig#scenarioId(String scenarioId): Advertising scenarios can be passed in, the same as getNativeAd(String scenario) |
(static) entryAdScenario | (String placementId, String scenarioId) | Enter the current ad slot cache status statistics in the business scenario. The scenario refers to the advertising display scene (not required, null can be passed directly). Scenario parameters can be created from the background and please refer to Business scenario cache status statistics |
Ad display:
private void showAd() {
/*
In order to calculate the scene arrival rate, relevant information can be consulted“ https://docs.toponad.com/#/zh -CN/android/NetworkAccess/scenario/scenario“
Call the "Enter Advertising Scene" method when the advertising triggering conditions are met, for example:
**If an advertisement pops up after the cleaning is completed, it will be called at the end of the cleaning;
*1. First call "entryAdScenario"
*2. Can calling "isAdReady" display
*3. Finally, call "show" to display
*4. Scenario ID is passed in to the backend scene management for data display
*/
ATInterstitial.entryAdScenario("your iv placementID", "your scenarioID");
if (mInterstitialAd.isAdReady()) {
mInterstitialAd.show(activity,"your scenarioID");
}
}
Pass in custom parameters when ad displaying:
Taku SDK v6.3.10 and above supports developers to pass in custom parameters during ad display. The custom parameters passed in during display are independent of the custom parameters passed in during load. Custom parameters passed in during presentation can be returned in the Taku SDK callback information.
ATInterstitial:
Parameter | Description | |
---|---|---|
setAdListener | (ATInterstitialListener listener) | Set Interstitial advertising listening callback, where ATInterstitialListener is the interface class that needs to implement advertising event callback |
setAdDownloadListener | (ATAppDownloadListener listener) | |
setAdSourceStatusListener | (ATAdSourceStatusListener listener) | Set advertising source level event listening callback, where ATAdSourceStatusListener is the interface class that needs to implement advertising source level event callbackSee ATAdSourceStatusListener description |
ATInterstitialListener: It is the event callback listener for Interstitial advertising:
Method | Parameter | Description |
---|---|---|
onInterstitialAdLoaded | - | Ad loading success callback |
onInterstitialAdLoadFail | (AdError error) | Ad loading failure callback, all error information can be obtained through AdError.getFullErrorInfo(), Please refer to AdError Note: It is prohibited to execute the advertising loading method in this callback for retry, otherwise it will cause many useless requests and may Will cause application lag |
onInterstitialAdClicked | (ATAdInfo atAdInfo) | Ad click, where ATAdInfo is the information object of the ad ATAdInfo: ad The information object can distinguish the advertising platform, mainly including the id information of the third-party aggregation platform See ATAdInfo information description |
onInterstitialAdShow | (ATAdInfo atAdInfo) | The meaning of the ad display callback parameters is the same as above It is recommended to call load in this callback to load the ad to facilitate the next ad display |
onInterstitialAdClose | (ATAdInfo atAdInfo) | Ad closing callback, The meaning of the parameters is the same as above |
onInterstitialAdVideoStart | (ATAdInfo atAdInfo) | The video ad starts playing callback parameter has the same meaning as above |
onInterstitialAdVideoEnd | (ATAdInfo atAdInfo) | The meaning of the video ad playback end callback parameters is the same as above |
onInterstitialAdVideoError | (AdError error) | The meaning of the callback parameters for video ad playback failure is the same as above |
Ad listening:
mInterstitialAd.setAdListener(new ATInterstitialListener() {
@Override
public void onInterstitialAdLoaded() {
}
@Override
public void onInterstitialAdLoadFail(AdError adError) {
//Note: It is prohibited to retry the loading method of advertisements in this callback, otherwise it will cause many useless requests and may cause the application to lag
//AdError,please refer to https://docs.toponad.com/#/zh-cn/android/android_doc/android_test?id=aderror
Log.e(TAG, "onInterstitialAdLoadFail:" + adError.getFullErrorInfo());
}
@Override
public void onInterstitialAdClicked(ATAdInfo atAdInfo) {
}
@Override
public void onInterstitialAdShow(ATAdInfo atAdInfo) {
//ATAdInfo can distinguish between advertising platforms and obtain advertising space IDs for advertising platforms
//please refer to https://docs.toponad.com/#/zh-cn/android/android_doc/android_sdk_callback_access?id=callback_info
//It is recommended to call load in this callback to load advertisements for the convenience of next advertisement display (isAdReady() is not required)
mInterstitialAd.load();
}
@Override
public void onInterstitialAdClose(ATAdInfo atAdInfo) {
}
@Override
public void onInterstitialAdVideoStart(ATAdInfo atAdInfo) {
}
@Override
public void onInterstitialAdVideoEnd(ATAdInfo atAdInfo) {
}
@Override
public void onInterstitialAdVideoError(AdError adError) {
//AdError,please refer to https://docs.toponad.com/#/zh-cn/android/android_doc/android_test?id=aderror
Log.e(TAG, "onInterstitialAdVideoError:" + adError.getFullErrorInfo());
}
});
ATInterstitialExListener: Inherited from ATInterstitialListener, the method is the same as ATInterstitialListener, the additional callback description is as follows:
Method | Parameters | Description |
---|---|---|
onDeeplinkCallback | (ATAdInfo adInfo, boolean isSuccess) | deeplink callback, for Adx, OnlineApi adsisSuccess: whether it is successful |
onDownloadConfirm | (Context context, ATAdInfo atAdInfo, View clickView, ATNetworkConfirmInfo networkConfirmInfo) | (new in v5.7.70) Callback method when application ads are clicked to download. ATNetworkConfirmInfo: The callback information provided by the third-party advertising platform(Currently only GDTDownloadFirmInfo of Youlianghui) ATAdInfo: The information object of the advertisement, which can distinguish the advertising platform, mainly including the id information of the third-party aggregation platformSee ATAdInfo information description |
ATAppDownloadListener: (Only supported by China SDK)Event callback monitoring for download status Currently only the following platforms are supported: Pangolin
Method | Parameters | Description |
---|---|---|
onDownloadStart | (ATAdInfo atAdInfo, long totalBytes, long currBytes, String fileName, String appName) | Start download callback ATAdInfo: advertising information object, Can distinguish advertising platforms, mainly including the id information of third-party aggregation platforms See ATAdInfo information description totalBytes: total file size (unit: bytes) currBytes : The currently downloaded size (unit: bytes) fileName: file name appName: application name corresponding to the file |
onDownloadUpdate | (ATAdInfo atAdInfo, long totalBytes, long currBytes, String fileName, String appName) | Download progress update callback parameters have the same meaning as above |
onDownloadPause | (ATAdInfo atAdInfo, long totalBytes, long currBytes, String fileName, String appName) | The meaning of the pause download callback parameter is the same as above |
onDownloadFinish | (ATAdInfo adInfo, long totalBytes, String fileName, String appName) | Download completion callback parameters have the same meaning as above |
onDownloadFail | (ATAdInfo adInfo, long totalBytes, long currBytes, String fileName, String appName) | Download The meaning of the failure callback parameters is the same as above |
onInstalled | (ATAdInfo adInfo, String fileName, String appName) | Apk installation completion callback parameters have the same meaning as above |
//Note: The advertising object must be globally referenced. If the advertising object is a temporary variable, it may be reclaimed during the advertising loading process and unable to receive advertising event callbacks
ATInterstitial mInterstitialAd;
private void loadAd() {
if (mInterstitialAd == null) {
mInterstitialAd = new ATInterstitial(this, interstitialTakuPlacementID);
mInterstitialAd.setAdListener(new ATInterstitialListener() {
@Override
public void onInterstitialAdLoaded() {
}
@Override
public void onInterstitialAdLoadFail(AdError adError) {
//Note: It is prohibited to retry the loading method of advertisements in this callback, otherwise it will cause many useless requests and may cause the application to lag
//AdError,please refer to https://docs.toponad.com/#/zh-cn/android/android_doc/android_test?id=aderror
Log.e(TAG, "onInterstitialAdLoadFail:" + adError.getFullErrorInfo());
}
@Override
public void onInterstitialAdClicked(ATAdInfo atAdInfo) {
}
@Override
public void onInterstitialAdShow(ATAdInfo atAdInfo) {
//ATAdInfo can distinguish between advertising platforms and obtain advertising space IDs for advertising platforms
//please refer to https://docs.toponad.com/#/zh-cn/android/android_doc/android_sdk_callback_access?id=callback_info
}
@Override
public void onInterstitialAdClose(ATAdInfo atAdInfo) {
}
@Override
public void onInterstitialAdVideoStart(ATAdInfo atAdInfo) {
//It is recommended to call load in this callback to load advertisements for the convenience of next advertisement display (isAdReady() is not required)
mInterstitialAd.load();
}
@Override
public void onInterstitialAdVideoEnd(ATAdInfo atAdInfo) {
}
@Override
public void onInterstitialAdVideoError(AdError adError) {
//AdError,please refer to https://docs.toponad.com/#/zh-cn/android/android_doc/android_test?id=aderror
Log.e(TAG, "onInterstitialAdVideoError:" + adError.getFullErrorInfo());
}
});
}
mInterstitialAd.load();
}
private void showAd() {
/*
In order to calculate the scene arrival rate, relevant information can be consulted“ https://docs.toponad.com/#/zh -CN/android/NetworkAccess/scenario/scenario“
Call the "Enter Advertising Scene" method when the advertising triggering conditions are met, for example:
**If an advertisement pops up after the cleaning is completed, it will be called at the end of the cleaning;
*1. First call "entryAdScenario"
*2. Can calling "isAdReady" display
*3. Finally, call "show" to display
*4. Scenario ID is passed in to the backend scene management for data display
*/
ATInterstitial.entryAdScenario("your iv placementID", "your scenarioID");
if (mInterstitialAd.isAdReady()) {
mInterstitialAd.show(activity,"your scenarioID");
}
}
For detailed interstitial ad sample code, please refer to: Demo's InterstitialAdActivity class