💡Tips:
- The custom Splash Ad Adapter must inherit com.anythink.splash.unitgroup.api.CustomSplashAdapter, 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 Splash Ad Adapter must inherit com.thinkup.splash.unitgroup.api.CustomSplashAdapter, 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 ATSplashAd. (Note: The context type is Activity.) 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 ATSplashAd#setLocalExtra() method can all be obtained through the localExtra parameter. |
| void show(Activity activity, ViewGroup container) | Used to display the ad. container: The container for displaying the ad. |
CustomSplashAdapter provides a member variable for the ad load timeout duration, which is the fetchAdTimeout variable passed through the ATSplashAd constructor. This variable can be used to set the timeout for the 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 TUSplashAd. (Note: The context type is Activity.) 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 TUSplashAd#setLocalExtra() method can all be obtained through the localExtra parameter. |
| void show(Activity activity, ViewGroup container) | Used to display the ad. container: The container for displaying the ad. |
CustomSplashAdapter provides a member variable for the ad load timeout duration, which is the fetchAdTimeout variable passed through the TUSplashAd constructor. This variable can be used to set the timeout for the ad network.
Use the CustomSplashEventListener member variable of CustomSplashAdapter to implement the ad event callbacks:
| Method | Description |
|---|---|
| void onSplashAdClicked() | Callback executed when the ad is clicked. |
| void onSplashAdShow() | Callback executed when the ad is displayed. |
| void onSplashAdDismiss() | Callback executed when the ad is dismissed. |
Note: When using the member variable
CustomSplashEventListener, a null check is required.
For code details, please refer to the Sample Adapter in the Demo.