Search...
Menu

App Open Ads

πŸ’‘Tips

  • Automatically manages multi-placement parallel loading, caching, and price-comparison display, developer only needs SmartLoad β†’ SmartIsReady β†’ SmartShow
  • Must ensure McSdk.InitializeSdk() is completed before calling SmartLoadAppOpenAd(), otherwise the call will be ignored
  • SDK automatically refills after ad is closed, no need to manually reload
  • fetchTimeout is the load timeout for the mediation unit, in milliseconds (effective v4.1.10+, automatically ignored on older versions)
  • Smart Cache has an independent callback channel McSdkCallbacks.SmartCache.AppOpen, completely isolated from the standard ad placement callback McSdkCallbacks.AppOpen

csharp Copy
public void InitializeSmartAppOpenAd()
{
    // Smart Cache independent callback channel (completely isolated from Ad Placement Mode)
    McSdkCallbacks.SmartCache.AppOpen.OnDidLoadAd += OnSmartAppOpenAdLoaded;
    McSdkCallbacks.SmartCache.AppOpen.OnDidFailToLoadAd += OnSmartAppOpenAdLoadFailed;
    McSdkCallbacks.SmartCache.AppOpen.OnDidDisplayAd += OnSmartAppOpenAdDisplayed;
    McSdkCallbacks.SmartCache.AppOpen.OnDidHideAd += OnSmartAppOpenAdHidden;
    McSdkCallbacks.SmartCache.AppOpen.OnDidClickAd += OnSmartAppOpenAdClicked;
    McSdkCallbacks.SmartCache.AppOpen.OnDidFailToDisplayAd += OnSmartAppOpenAdDisplayFailed;
    McSdkCallbacks.SmartCache.AppOpen.OnDidPayRevenueForAd += OnSmartAppOpenAdRevenuePaid;
    McSdkCallbacks.SmartCache.AppOpen.OnDidAdLoadFinished += OnSmartAppOpenAdLoadFinished;
    // App open ad specific callback
    McSdkCallbacks.SmartCache.AppOpen.OnDidAdLoadTimeout += OnSmartAppOpenAdLoadTimeout;

    // No need to pass adUnitId, managed by server strategy
    // fetchTimeout in milliseconds, effective v4.1.10+, automatically ignored on older versions
    McSdk.SmartLoadAppOpenAd(15 * 1000);
}

private void OnSmartAppOpenAdLoaded(string adUnitId, McSdkBase.AdInfo adInfo)
{
    // At least one ad is ready
}

private void OnSmartAppOpenAdLoadFailed(McSdkBase.ErrorInfo errorInfo)
{
    // All ad placements failed to load
    // Automatically retries, no manual reload needed
}

private void OnSmartAppOpenAdDisplayed(string adUnitId, McSdkBase.AdInfo adInfo)
{
    // Display success callback
}

private void OnSmartAppOpenAdHidden(string adUnitId, McSdkBase.AdInfo adInfo)
{
    // Ad closed callback
    // SDK automatically refills, no manual operation needed
}

private void OnSmartAppOpenAdClicked(string adUnitId, McSdkBase.AdInfo adInfo)
{
    // Click callback
}

private void OnSmartAppOpenAdDisplayFailed(McSdkBase.ErrorInfo errorInfo, McSdkBase.AdInfo adInfo)
{
    // Display failed callback
    // Automatically handled, no manual reload needed
}

private void OnSmartAppOpenAdRevenuePaid(string adUnitId, McSdkBase.AdInfo adInfo)
{
    // Revenue callback
}

private void OnSmartAppOpenAdLoadFinished()
{
    // End of all ad placements load round callback (triggers regardless of success or failure)
    // Differences from OnDidLoadAd / OnDidFailToLoadAd:
    // OnDidLoadAd β€” triggers when at least one ad placement loads successfully
    // OnDidFailToLoadAd β€” triggers when all ad placements fail to load
    // OnDidAdLoadFinished β€” always triggers when the current load round finishes
}

private void OnSmartAppOpenAdLoadTimeout()
{
    // App open ad specific: load timeout callback (fetchTimeout expired)
}

⚠️ Note: In Smart Cache mode, there is no need to manually call SmartLoadAppOpenAd() in the OnDidFailToLoadAd / OnDidFailToDisplayAd / OnDidHideAd callbacks to reload. The SDK automatically manages refill and retry internally.

πŸ“Œ Duplicate calls to SmartLoadAppOpenAd() during loading will be automatically ignored, developers do not need to manually handle anti-duplicate logic.

πŸ“Œ Smart Cache callback McSdkCallbacks.SmartCache.AppOpen is completely isolated from the standard ad placement callback McSdkCallbacks.AppOpen. Both callback sets can be registered simultaneously without interference.


csharp Copy
if (McSdk.SmartIsAppOpenAdReady()) {
    // SDK automatically selects the ad with the highest eCPM from the cache pool to show
    McSdk.SmartShowAppOpenAd();
}

πŸ“Œ When SmartIsAppOpenAdReady() returns false, the SDK automatically triggers background refill, developers do not need to perform additional operations.

πŸ“Œ After the ad is shown, the SDK automatically refills, maintaining available ads in the cache pool.


3. Set Custom Parameters

csharp Copy
McSdk.SmartSetAppOpenAdExtraParameter("key", "value");
#if UNITY_ANDROID
    McSdk.SmartSetAppOpenAdLocalExtraParameter("key", new AndroidJavaObject("java.lang.String", "value"));
#elif UNITY_IOS
    McSdk.SmartSetAppOpenAdLocalExtraParameter("key", "value");
#endif

// Must be set before SmartLoadAppOpenAd(), parameters take effect for all subsequent load requests
McSdk.SmartLoadAppOpenAd(15 * 1000);

Last modified: 2026-04-03Powered by