💡Tips:
- The custom Banner Ad Adapter must inherit com.anythink.banner.unitgroup.api.CustomBannerAdapter, 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 Banner Ad Adapter must inherit com.thinkup.banner.unitgroup.api.CustomBannerAdapter, 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 ATBannerView. 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 ATBannerView#setLocalExtra() method can all be obtained through the localExtra parameter. |
| View getBannerView() | Must return the BannerView object that has been successfully loaded. |
| 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 TUBannerView. 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 TUBannerView#setLocalExtra() method can all be obtained through the localExtra parameter. |
| View getBannerView() | Must return the BannerView object that has been successfully loaded. |
Use the CustomBannerEventListener member variable of CustomBannerAdapter to implement the ad event callbacks:
| Method | Description |
|---|---|
| void onBannerAdClicked() | Callback executed when the ad is clicked. |
| void onBannerAdShow() | Callback executed when the ad is displayed. |
| void onBannerAdClose() | Callback executed when the ad is dismissed. |
Note: When using the member variable
CustomBannerEventListener, a null check is required.
For code details, please refer to the Sample Adapter in the Demo.