💡Tips:
- The custom Interstitial Ad Adapter must inherit com.anythink.interstitial.unitgroup.api.CustomInterstitialAdapter, override all abstract methods, call the ad network's API in the corresponding methods, and use the member variable
mLoadListenerto callback the load result, and use the member variablemImpressionListenerto callback ad display, click, close, and other event results.
💡Tips:
- The custom Interstitial Ad Adapter must inherit com.thinkup.interstitial.unitgroup.api.CustomInterstitialAdapter, override all abstract methods, call the ad network's API in the corresponding methods, and use the member variable
mLoadListenerto callback the load result, and use the member variablemImpressionListenerto callback ad display, click, close, and other event results.
| Method | Description |
|---|---|
| void loadCustomNetworkAd(Context context, Map serverExtra, Map localExtra) | Implement the ad loading logic of the custom ad network. context: Corresponds to the context value passed to ATInterstitial. serverExtra: Custom parameters configured on the server side. The key-value pairs in the JSON string configured in the TopOn dashboard can all be obtained through the serverExtra parameter. localExtra: Custom parameters passed in for this load. The key-value pairs passed through the ATInterstitial#setLocalExtra() method can all be obtained through the localExtra parameter. |
| boolean isAdReady() | Used to determine whether the interstitial ad of the custom ad network is in a ready state. |
| void show(Activity activity) | Implement the logic for displaying the interstitial ad of the custom ad network. |
| Method | Description |
|---|---|
| void loadCustomNetworkAd(Context context, Map serverExtra, Map localExtra) | Implement the ad loading logic of the custom ad network. context: Corresponds to the context value passed to TUInterstitial. serverExtra: Custom parameters configured on the server side. The key-value pairs in the JSON string configured in the TopOn dashboard can all be obtained through the serverExtra parameter. localExtra: Custom parameters passed in for this load. The key-value pairs passed through the TUInterstitial#setLocalExtra() method can all be obtained through the localExtra parameter. |
| boolean isAdReady() | Used to determine whether the interstitial ad of the custom ad network is in a ready state. |
| void show(Activity activity) | Implement the logic for displaying the interstitial ad of the custom ad network. |
Use the CustomInterstitialEventListener member variable of CustomInterstitialAdapter to implement the ad event callbacks:
| Method | Description |
|---|---|
| void onInterstitialAdVideoStart() | Callback executed when the ad video starts playing. |
| void onInterstitialAdVideoEnd() | Callback executed when the ad video finishes playing. |
| void onInterstitialAdVideoError(String errorCode, String errorMsg) | Callback executed when the ad video fails to play. errorCode: Error code information. errorMsg: Detailed error information. |
| void onInterstitialAdClose() | Callback executed when the ad page is closed. |
| void onInterstitialAdClicked() | Callback executed when the ad is clicked. |
| void onInterstitialAdShow() | Callback executed when the ad page is opened. |
Note: When using the member variable
CustomInterstitialEventListener, a null check is required.
For code details, please refer to the Sample Adapter in the Demo.