Menu

App-Open

💡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 (McSmartCacheAppOpenListener), which does not interfere with the standard app open ad callbacks.
  • App open ads support a timeout parameter to control load timeout, and an onDidAdLoadTimeout timeout callback.
  • If you need manual control over loading and caching, refer to here

1. Set Up Callback Listener

Before loading ads, register the independent Smart Cache app open ad callback:

dart Copy
McSdk.setSmartCacheAppOpenListener(McSmartCacheAppOpenListener(
  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
  },
  onDidAdLoadTimeout: () {
    // Load timeout callback
  },
));

Call the following method to trigger Smart Cache app open ad loading. The SDK will automatically manage parallel requests and caching across multiple placements:

dart Copy
McSdk.smartLoadAppOpenAd();

// Set a custom timeout (in milliseconds) (example: 5 seconds)
McSdk.smartLoadAppOpenAd(timeout: 5000);
Parameter Type Default Description
timeout int -1 Load timeout in milliseconds; -1 means not set

3. Check If Ad Is Ready

Before showing, use the following method to check whether a cached ad is available:

dart Copy
bool? isReady = await McSdk.smartIsAppOpenAdReady();
if (isReady == true) {
  // Ad is ready and can be shown
}

When the ad is ready, call the following method to show the app open ad:

dart Copy
McSdk.smartShowAppOpenAd();

5. Set Custom Parameters

Use the following methods to set extra parameters for fine-grained control over ad behavior:

dart Copy
// Set Extra Parameter (Max only)
McSdk.smartSetAppOpenAdExtraParameter("key", "value");

// Set Local Extra Parameter
McSdk.smartSetAppOpenAdLocalExtraParameter("key", value);
Previous
Interstitial
Next
Rewarded-Video
Last modified: 2026-06-25Powered by