GreedyGameAds.Instance.LoadInterstitialAd("SDK X Interstitial adUnit");
//TO check if Interstitial is loaded
GreedyGameAds.Instance.interstitialAd.IsLoaded
using UnityEngine;
using GreedyGame;
public class GreedyGameAdsDemoScript : MonoBehaviour
{
private void Start()
{
//after Initialize the GreedygameAds sdk
this.LoadInterstitial();
}
public void LoadInterstitial()
{
GreedyGameAds.Instance.LoadInterstitialAd("SDK X Interstitial adUnit");
}
}
GreedyGameAds.Instance.ShowInterstitialAd();
public void GameOver()
{
. . .
. . .
this.ShowInterstitial();
}
//After Interstitial Method loaded
public void ShowInterstitial()
{
GreedyGameAds.Instance.ShowInterstitialAd();
}
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.interstitialAd.OnAdLoaded
GreedyGameAds.Instance.interstitialAd.OnAdFailedToLoad
GreedyGameAds.Instance.interstitialAd.OnAdOpened
GreedyGameAds.Instance.interstitialAd.OnAdClosed
GreedyGameAds.Instance.interstitialAd.OnAdShowFailed
public void LoadInterstitial()
{
GreedyGameAds.Instance.LoadInterstitial("SDK X Interstitial adUnit");
// Called when an ad request has successfully loaded.
GreedyGameAds.Instance.interstitialAd.OnAdloaded += this.HandleOnAdLoaded;
// Called when an ad request failed to load.
GreedyGameAds.Instance.interstitialAd.OnAdFailedToLoad= this.HandleOnAdFailedToLoad;
// Called when an ad is clicked.
GreedyGameAds.Instance.interstitialAd..OnAdOpened+= this.HandleOnAdOpened;
// Called when the user returned from the app after an ad click.
GreedyGameAds.Instance.interstitialAd.OnAdClosed += this.HandleOnAdClosed;
// Called when the ad Failed to show
GreedyGameAds.Instance.interstitialAd.OnAdShowFailed += this.HandleOnAdShowFailed;
}
public void HandleOnAdLoaded()
{
MonoBehaviour.print("HandleAdLoaded event received");
}
public void HandleOnAdFailedToLoad(string error)
{
MonoBehaviour.print("HandleFailedToLoadAd 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");
}