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.
- 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
Create Ad Instance
private DaroAppOpenAd ad;
ad = new DaroAppOpenAd("your-appopen-ad-unit-id");
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);
Subscribe to App State Changes
DaroAppStateNotifier.OnAppStateChanged += OnAppStateChanged;
Show on Foreground Return
private void OnAppStateChanged(DaroAppStateNotifier.AppState state)
{
if (state == DaroAppStateNotifier.AppState.Foreground
&& ad != null
&& ad.IsReady())
{
ad.Show();
}
}
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.