💡Tips
- Smart Cache automatically manages parallel loading, caching, and waterfall display across multiple placements — no need to pass a Mediation Unit ID (adUnitId).
- 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 (
McSmartCacheRewardedListener), which does not interfere with the standard rewarded video ad callbacks.- Rewarded video additionally provides reward delivery and video playback status callbacks.
- If you need manual control over loading and caching, refer to here
Before loading ads, register the independent Smart Cache rewarded video ad callback:
McSdk.setSmartCacheRewardedListener(McSmartCacheRewardedListener(
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
},
onDidRewardUserForAd: (McAd ad, McReward reward) {
// Reward granted successfully, handle reward logic here
},
onDidFailToRewardUserForAd: (McAd ad) {
// Failed to grant reward
},
onDidAdVideoStarted: (McAd ad) {
// Video started playing
},
onDidAdVideoCompleted: (McAd ad) {
// Video playback completed
},
));
Call the following method to trigger Smart Cache rewarded video ad loading. The SDK will automatically manage parallel requests and caching across multiple placements:
McSdk.smartLoadRewardedAd();
Before showing, use the following method to check whether a cached ad is available:
bool? isReady = await McSdk.smartIsRewardedAdReady();
if (isReady == true) {
// Ad is ready and can be shown
}
When the ad is ready, call the following method to show the rewarded video ad:
McSdk.smartShowRewardedAd();
Use the following methods to set extra parameters for fine-grained control over ad behavior:
// Set Extra Parameter (Max only)
McSdk.smartSetRewardedAdExtraParameter("key", "value");
// Set Local Extra Parameter
McSdk.smartSetRewardedAdLocalExtraParameter("key", value);