Search...
Menu

Interstitial Ads

πŸ’‘Tips

  • Automatically manages parallel loading across multiple placements, caching, and eCPM-optimized display β€” developers only need load β†’ isReady β†’ show
  • load() must be called only after MCSDK.init() completes, otherwise loading silently fails
  • SDK auto-refills after ad close, no manual reload needed; isReady() returning false also triggers automatic background refill

java Copy
// 1. Set callbacks
MCInterstitialAdManager.getInstance().setListener(new MCInterstitialAdManagerListener() {
    @Override
    public void onAdLoaded(MCAdInfo adInfo) {
        // At least one ad is ready (triggered at most once per loading round)
    }

    @Override
    public void onAdLoadFailed(MCError error) {
        // All placements failed to load (mutually exclusive with onAdLoaded)
    }

    @Override
    public void onAdLoadFinished() {
        // All placements in this round have finished loading (fires regardless of success or failure)
    }

    @Override
    public void onAdDisplayed(MCAdInfo adInfo) {
        // Ad displayed successfully
    }

    @Override
    public void onAdHidden(MCAdInfo adInfo) {
        // Ad closed (SDK auto-refills, no manual load needed)
    }

    @Override
    public void onAdClicked(MCAdInfo adInfo) {
        // Ad clicked
    }

    @Override
    public void onAdDisplayFailed(MCAdInfo adInfo, MCError error) {
        // Display failed
    }

    @Override
    public void onAdRevenuePaid(MCAdInfo adInfo) {
        // Ad revenue callback (for revenue attribution)
    }
});

// 2. Load (SDK automatically manages multiple placements based on server configuration)
MCInterstitialAdManager.getInstance().load();

⚠️ Note

  • setListener() should be called before load(), otherwise the first loading callbacks may be missed
  • Duplicate load() calls during an ongoing loading cycle are automatically ignored β€” no manual deduplication needed

java Copy
if (MCInterstitialAdManager.getInstance().isReady()) {
    MCInterstitialAdManager.getInstance().show(activity);
}

πŸ’‘ Note

  • show() automatically selects the highest eCPM ad from the cache pool β€” no manual comparison needed
  • After display, the cache for that placement is consumed and the SDK auto-refills
  • When isReady() returns false, the SDK automatically triggers background refill β€” you can periodically poll to check readiness

3. Resource Release

java Copy
MCInterstitialAdManager.getInstance().destroy();

⚠️ Note

  • Must call destroy() when Activity / Fragment is destroyed to release resources
  • After destruction, load() must be called again before further use
  • destroy() is safe to call repeatedly

4. Customized Parameter Configuration

java Copy
Map<String, Object> loadExtraParameter = new HashMap<>();
loadExtraParameter.put("key", "value");
MCInterstitialAdManager.getInstance().setLoadExtraParameter(loadExtraParameter);

Map<String, String> extraParameter = new HashMap<>();
extraParameter.put("key", "value");
MCInterstitialAdManager.getInstance().setExtraParameter(extraParameter);

// Custom parameters must be set before load()
MCInterstitialAdManager.getInstance().load();

Last modified: 2026-04-02Powered by