Fully automatic loading mode is a one-stop request maintenance solution launched by Taku. It can intelligently determine the preloading and caching of the next advertisement based on the user's usage status and advertisement consumption progress. opportunity. 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. SDK begins to support fully automatic loading mode.
ATInterstitialAutoAd: Management class for fully automatic loading of interstitial ads
method | Parameters | Description |
---|---|---|
(Context context, String[] placementIds, ATInterstitialAutoLoadListener loadListener) | ATInterstitialAutoAd initialization method of advertising. After initialization, it will automatically initiate advertising loading for the specified advertising slot context: If the following platforms are integrated: gdt、sigmob、Baidu, ironSource, Kidoz, Maio, Tabjoy, context must be Activity placementIds: Enable fully automatic loading of the advertising slot Id (can pass null) loadListener: ad filling callback, ATInterstitialAutoLoadListener description is shown below |
Initialization:
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//It is recommended to pass in the activity for initialization when creating the main activity onCreate
ATInterstitialAutoAd.init(MainActivity.this, new String[]{"your iv placementID1", "your iv placementID2"},autoLoadListener);
}
}
ATInterstitialAutoAd:
method | Parameters | Description |
---|---|---|
isAdReady | (String placementId) | Determine if there are any showable advertisements in the advertising space PlacementId: The ID of the advertising space to be queried |
show | (Activity activity, String placementId, ATInterstitialAutoEventListener eventListener) | Display the inserted advertisement in the advertising space Activity: Activity for displaying advertisements PlacementId: The ID of the advertising space to be displayed EventListener: Callback for display of inserted ads, please refer to the description below for the ATInterstialAutoEventListener |
(Activity activity, String placementId, String scenario, ATInterstitialAutoEventListener eventListener) | (Deprecated since v6.3.10) Display the inserted advertisement in the advertising space activity: The parameter meaning is the same as above placementId: The parameter has the same meaning as above scenario: Advertising scene ID, scene parameters can be created and used from the background. Please refer to Business scenario cache status statistics eventListener:The parameter meaning is the same as above | |
show | (Activity activity, String placementId, ATShowConfig showConfig, ATInterstitialAutoEventListener eventListener) | (v6.3.10+) Display the inserted advertisement in the advertising space activity: The parameter meaning is the same as above placementId: The parameter has the same meaning as above 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) eventListener:The parameter meaning is the same as above |
entryAdScenario | (String placementId, String scenarioId) | Statistics on the cache status of corresponding advertising spaces entering business scenarios PlacementId: Advertising Space Id Scenario: Advertising display scene, scene parameters can be created and used from the background, please refer to Business scenario cache status statistics |
Advertising display:
/*
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 placementID1", "your scenarioID"");
//Need to determine if the advertising space is ready
if(ATInterstitialAutoAd.isAdReady("your iv placementID1")){
ATInterstitialAutoAd.show(activity, "your iv placementID1","your scenarioID", autoEventListener);
}
ATInterstitialAutoAd:
method | Parameters | Description |
---|---|---|
checkAdStatus | (String placementId) | Obtain the status object ATAdStatusInfo for this advertising space. The API description for the ATAdStatusInfo object can be found below PlacementId: The ID of the advertising space to be queried |
checkValidAdCaches | (String placementId) | The ATAdInfo object that queries all cached information for this advertising space PlacementId: The ID of the advertising space to be queried |
addPlacementId | (String... placementIds) | Add ad space that needs to be fully automatically loaded PlacementIds: Ad slot IDs need to be fully automatically loaded |
removePlacementId | (String... placementIds) | Remove ad spaces that do not require fully automatic loading PlacementIds: No need for fully automatic loading of ad slot IDs |
ATAdStatusInfo:Status object of advertising space
method | Parameters | Description |
---|---|---|
isLoading | - | Determine whether the current advertising space is loading advertisements |
isReady | - | Determine whether there are showable ads in the current advertising space, similar to the ATInterstialAutoAd. isAdReady() method |
getATTopAdInfo | - | Retrieve the ATAdInfo object with the highest priority for the current advertising space's advertising cache information ATAdInfo: The information object of an advertisement, which can distinguish between advertising platforms and mainly includes the ID information of third-party aggregation platforms See ATAdInfo information description 2.4 Advertising monitoring |
ATInterstitialAutoLoadListener:ATInterstitialAutoAd Callback listening for loading events of advertisements:
method | Parameters | Description |
---|---|---|
onInterstitialAutoLoaded | (String placementId) | Callback for successful loading of corresponding advertising space advertisements PlacementId: Corresponds to the advertising space Id |
onInterstitialAutoLoadFail | (String placementId, AdError adError) | Callback for failed loading of corresponding advertising space advertisements PlacementId: Advertising Space Id AdError: Ad loading failure message, all error information can be obtained through AdError. getFullErrorInfo(), please refer to AdError |
Listening Example:
private static final ATInterstitialAutoLoadListener autoLoadListener = new ATInterstitialAutoLoadListener() {
@Override
public void onInterstitialAutoLoaded(String placementId) {
Log.i(TAG, "PlacementId:" + placementId + ": onInterstitialAutoLoaded");
}
@Override
public void onInterstitialAutoLoadFail(String placementId, AdError adError) {
Log.i(TAG, "PlacementId:" + placementId + ": onInterstitialAutoLoadFail:\n" + adError.getFullErrorInfo());
};
ATInterstitialAutoEventListener:ATInterstitialAutoAd Event callback monitoring for advertisements:
method | Parameters | Description |
---|---|---|
onInterstitialAdClicked | (ATAdInfo atAdInfo) | Ad click callback ATAdInfo: The information object of an advertisement, which can distinguish between advertising platforms and mainly includes the ID information of third-party aggregation platforms See ATAdInfo information description |
onInterstitialAdShow | (ATAdInfo atAdInfo) | Advertising display callback The parameter meaning is the same as above |
onInterstitialAdClose | (ATAdInfo atAdInfo) | Ad close callback The parameter meaning is the same as above |
onInterstitialAdVideoStart | (ATAdInfo atAdInfo) | Video advertisement start playback callback The parameter meaning is the same as above |
onInterstitialAdVideoEnd | (ATAdInfo atAdInfo) | Video ad playback end callback The parameter meaning is the same as above |
onInterstitialAdVideoError | (AdError adError) | Callback for video advertisement playback failure AdError: All error information can be obtained through AdError. getFullErrorInfo(), please refer to AdError |
Listening Example:
private static final ATInterstitialAutoEventListener autoEventListener = new ATInterstitialAutoEventListener() {
@Override
public void onInterstitialAdClicked(ATAdInfo adInfo) {
Log.i(TAG, "onInterstitialAdClicked:" + adInfo.toString());
@Override
public void onInterstitialAdShow(ATAdInfo adInfo) {
Log.i(TAG, "onInterstitialAdShow:" + adInfo.toString());
}
@Override
public void onInterstitialAdClose(ATAdInfo adInfo) {
Log.i(TAG, "onInterstitialAdClose:" + adInfo.toString());
}
@Override
public void onInterstitialAdVideoStart(ATAdInfo adInfo) {
Log.i(TAG, "onInterstitialAdVideoStart:" + adInfo.toString());
}
@Override
public void onInterstitialAdVideoEnd(ATAdInfo adInfo) {
Log.i(TAG, "onInterstitialAdVideoEnd:" + adInfo.toString());
}
@Override
public void onInterstitialAdVideoError(AdError adError) {
Log.i(TAG, "onInterstitialAdVideoError:" + adError.getFullErrorInfo());
}
};
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//It is recommended to pass in the activity for initialization when creating the main activity onCreate
ATInterstitialAutoAd.init(MainActivity.this, new String[]{"placementId1", "placementId2"},autoLoadListener);
}
private static final ATInterstitialAutoLoadListener autoLoadListener = new ATInterstitialAutoLoadListener() {
@Override
public void onInterstitialAutoLoaded(String placementId) {
Log.i(TAG, "PlacementId:" + placementId + ": onInterstitialAutoLoaded");
}
@Override
public void onInterstitialAutoLoadFail(String placementId, AdError adError) {
Log.i(TAG, "PlacementId:" + placementId + ": onInterstitialAutoLoadFail:\n" + adError.getFullErrorInfo());
};
/*
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(placementId, "scenario");
//Need to determine if the advertising space is ready
if(ATInterstitialAutoAd.isAdReady("placementId1")){
ATInterstitialAutoAd.show(activity, "placementId1","scenario", autoEventListener);
}
private static final ATInterstitialAutoEventListener autoEventListener = new ATInterstitialAutoEventListener() {
@Override
public void onInterstitialAdClicked(ATAdInfo adInfo) {
Log.i(TAG, "onInterstitialAdClicked:" + adInfo.toString());
@Override
public void onInterstitialAdShow(ATAdInfo adInfo) {
Log.i(TAG, "onInterstitialAdShow:" + adInfo.toString()); }
@Override
public void onInterstitialAdClose(ATAdInfo adInfo) {
Log.i(TAG, "onInterstitialAdClose:" + adInfo.toString()); }
@Override
public void onInterstitialAdVideoStart(ATAdInfo adInfo) {
Log.i(TAG, "onInterstitialAdVideoStart:" + adInfo.toString()); }
@Override
public void onInterstitialAdVideoEnd(ATAdInfo adInfo) {
Log.i(TAG, "onInterstitialAdVideoEnd:" + adInfo.toString()); }
@Override
public void onInterstitialAdVideoError(AdError adError) {
Log.i(TAG, "onInterstitialAdVideoError:" + adError.getFullErrorInfo());
}
};
}
Please refer to the following for detailed example code of screen insertion advertisements:InterntialAdActivity class for Demo
method | Parameters | 说明 |
---|---|---|
setLocalExtra | (String placementId, Map | Set local parameters for specified advertising spaces PlacementId: Advertising Space Id LocalExt: Local parameter |
The incentive video should be used as a screen insert (calling Sigmab's incentive video API), and the Sigmab advertising source for the Taku backend insertion advertising space needs to be configured with Sigmab's incentive video advertising space ID
...
//Only for the Sigmab platform
Map localMap = new HashMap<>();
localMap.put(SigmobATConst.IS_USE_REWARDED_VIDEO_AS_INTERSTITIAL, true);
ATInterstitialAutoAd.setLocalExtra("placementA",localMap);
ATInterstitialAutoAd.init(context,"placementA",autoLoadListener);
//ATInterstitialAutoAd.placementNameToPlacementIds("placementA");
Developers can set the width of the insert image advertisement on the pangolin platform using the following code. The SDK will automatically calculate the height based on the proportion configured in the background and the width passed in by the developer
...
int width = ;
Map localMap = new HashMap<>();
localMap.put(ATAdConst.KEY.AD_WIDTH, width);//unit:px
ATInterstitialAutoAd.setLocalExtra("placementA",localMap);
ATInterstitialAutoAd.init(context,"placementA",autoLoadListener);
//ATInterstitialAutoAd.placementNameToPlacementIds("placementA");
Developers can control the width and height of the insert image advertisement on the pangolin platform through the following code. Developers need to ensure that the width and height ratio are consistent with the advertising space ratio (when ATAdConst.KEY.AD_HEIGHT is not passed, pangolin's adaptive height display advertisement will be used)
int width = ;
int height = ;
Map localMap = new HashMap<>();
localMap.put(ATAdConst.KEY.AD_WIDTH, width);//unit:px
localMap.put(ATAdConst.KEY.AD_HEIGHT, height);//unit:px
ATInterstitialAutoAd.setLocalExtra("placementA",localMap);
ATInterstitialAutoAd.init(context,"placementA",autoLoadListener);
//ATInterstitialAutoAd.placementNameToPlacementIds("placementA");