GreedyGameAds.Instance.LoadAppOpen("SDK X AppOpen adUnit");
//To check if AppOpen is loaded
GreedyGameAds.Instance.appOpenAd.IsLoaded
using UnityEngine;
using GreedyGame;
public class GreedyGameAdsDemoScript : MonoBehaviour
{
private void Start()
{
//after Initialize the GreedygameAds sdk
this.LoadAppOpenAd();
}
public void LoadAppOpenAd()
{
GreedyGameAds.Instance.LoadAppOpen("SDK X AppOpen adUnit");
}
}
GreedyGameAds.Instance.ShowAppOpen();
void Start()
{
. . .
. . .
this.ShowAppOpenAd();
}
//After AppOpen Method Loaded
public void ShowAppOpenAd()
{
GreedyGameAds.Instance.ShowAppOpen();
}
To further customize the behavior of your ad, you can hook into a number of events in the ad's lifecycle: loading, opening, closing, and so on. Listen for these events by registering a delegate for the appropriate EventHandler, as shown below
GreedyGameAds.Instance.appOpenAd.OnAdloaded
GreedyGameAds.Instance.appOpenAd.OnAdFailedToLoad
GreedyGameAds.Instance.appOpenAd.OnAdOpened
GreedyGameAds.Instance.appOpenAd.OnAdClosed
GreedyGameAds.Instance.appOpenAd.OnAdShowFailed
public void LoadAppOpenAd()
{
GreedyGameAds.Instance.LoadAppOpen("SDK X AppOpen adUnit");
// Called when an ad request has successfully loaded.
GreedyGameAds.Instance.appOpenAd.OnAdloaded += this.HandleOnAdLoaded;
// Called when an ad request failed to load.
GreedyGameAds.Instance.appOpenAd.OnAdFailedToLoad= this.HandleOnAdFailedToLoad;
// Called when an ad is clicked.
GreedyGameAds.Instance.appOpenAd.OnAdOpened+= this.HandleOnAdOpened;
// Called when the user returned from the app after an ad click.
GreedyGameAds.Instance.appOpenAd.OnAdClosed += this.HandleOnAdClosed;
// Called when the ad Failed to show
GreedyGameAds.Instance.appOpenAd.OnAdShowFailed += this.HandleOnAdShowFailed;
}
public void HandleOnAdLoaded()
{
MonoBehaviour.print("HandleAdLoaded event received");
}
public void HandleOnAdFailedToLoad(string error)
{
MonoBehaviour.print("HandleFailedToLoad event received with message: " +error);
}
public void HandleOnAdOpened()
{
MonoBehaviour.print("HandleAdOpened event received");
}
public void HandleOnAdClosed()
{
MonoBehaviour.print("HandleAdClosed event received");
}
public void HandleOnAdShowFailed()
{
MonoBehaviour.print("HandleAdShowFailed event received");
}