Skip to main content

Documentation Index

Fetch the complete documentation index at: https://guide.daro.so/llms.txt

Use this file to discover all available pages before exploring further.

App Open Ad Format

  • Full-screen ads shown when the app returns from background to foreground.
  • Prefer showing them on warm foreground returns, not immediately on first launch.

Integrating Ads

1

Create Ad Instance

private DaroAppOpenAd ad;

ad = new DaroAppOpenAd("your-appopen-ad-unit-id");
2

Register Event Handlers

ad.OnAdLoaded += info => Debug.Log("app open loaded");
ad.OnAdFailedToLoad += error => Debug.LogWarning(error.Message);
ad.OnAdFailedToShow += error => Debug.LogWarning(error.Message);
3

Subscribe to App State Changes

DaroAppStateNotifier.OnAppStateChanged += OnAppStateChanged;
4

Show on Foreground Return

private void OnAppStateChanged(DaroAppStateNotifier.AppState state)
{
    if (state == DaroAppStateNotifier.AppState.Foreground
        && ad != null
        && ad.IsReady())
    {
        ad.Show();
    }
}
5

Unsubscribe and Dispose

DaroAppStateNotifier.OnAppStateChanged -= OnAppStateChanged;
ad?.Dispose();
ad = null;

Example

using Daro;
using UnityEngine;

public sealed class AppOpenHost : MonoBehaviour
{
    [SerializeField] private string adUnitId = "your-appopen-ad-unit-id";
    private DaroAppOpenAd ad;
    private bool hasEnteredBackground;

    private void OnEnable()
    {
        ad = new DaroAppOpenAd(adUnitId);
        ad.OnAdLoaded += info => Debug.Log("app open loaded");
        ad.OnAdFailedToLoad += error => Debug.LogWarning(error.Message);
        ad.OnAdFailedToShow += error => Debug.LogWarning(error.Message);
        ad.Load();

        DaroAppStateNotifier.OnAppStateChanged += OnAppStateChanged;
    }

    private void OnAppStateChanged(DaroAppStateNotifier.AppState state)
    {
        if (state == DaroAppStateNotifier.AppState.Foreground
            && ad != null
            && hasEnteredBackground
            && ad.IsReady())
        {
            ad.Show();
        }

        if (state == DaroAppStateNotifier.AppState.Background)
        {
            hasEnteredBackground = true;
        }
    }

    private void OnDisable()
    {
        DaroAppStateNotifier.OnAppStateChanged -= OnAppStateChanged;
        ad?.Dispose();
        ad = null;
    }
}
Do not show app open ads immediately on first launch. Show them when the app returns from background to foreground.
On Android, OnAdLoaded can overlap with native preload flow. Check display readiness with IsReady() instead of relying only on an OnAdLoaded flag.
App open ads can use automatic preload after dismiss. Do not repeatedly call Load() from OnAdDismissed.