💡Tips
- Smart Cache automatically manages parallel loading, caching, and waterfall display across multiple placements — no need to pass a Mediation Unit ID.
- After an ad is closed, the SDK auto-replenishes the cache; developers do not need to manually trigger a second load.
- Smart Cache has its own independent callback channel (
McSmartCacheInterstitialListener), which does not interfere with the standard interstitial ad callbacks.- If you need manual control over loading and caching, refer to here
Before loading ads, register the independent Smart Cache interstitial ad callback:
McSdk.setSmartCacheInterstitialListener(McSmartCacheInterstitialListener(
onDidLoadAd: (McAd ad) {
// At least one ad is ready and can be shown
},
onDidFailToLoadAd: (McError error) {
// All placements failed to load
},
onDidDisplayAd: (McAd ad) {
// Ad displayed successfully
},
onDidHideAd: (McAd ad) {
// Ad closed, SDK auto-replenishes
},
onDidClickAd: (McAd ad) {
// Ad was clicked
},
onDidFailToDisplayAd: (McAd ad, McError error) {
// Ad failed to display
},
onDidAdLoadFinished: () {
// Current load round finished (regardless of success or failure)
},
onDidPayRevenueForAd: (McAd ad) {
// Revenue callback
},
));
Call the following method to trigger Smart Cache interstitial ad loading. The SDK will automatically manage parallel requests and caching across multiple placements:
McSdk.smartLoadInterstitial();
Before showing, use the following method to check whether a cached ad is available:
bool? isReady = await McSdk.smartIsInterstitialReady();
if (isReady == true) {
// Ad is ready and can be shown
}
When the ad is ready, call the following method to show the interstitial ad:
McSdk.smartShowInterstitial();
Use the following methods to set extra parameters for fine-grained control over ad behavior:
// Set Extra Parameter (Max only)
McSdk.smartSetInterstitialExtraParameter("key", "value");
// Set Local Extra Parameter
McSdk.smartSetInterstitialLocalExtraParameter("key", value);