Interstitial Ads

Load

Interstitial Ads start loading automatically right after creation an instance:

string interstitialIdentifier = BidappBinding.Instance.CreateInterstitial();

From creation function you will obtain an Interstitial Ad identifier that will be required to show and destroy ads, receive callbacks.

To check if Interstitial is Ready to be displayed you may use next function:

BidappBinding.Instance.IsInterstitialAdReady(interstitialIdentifier);

Show

To show an interstitial ad, call showInterstitial instance function and provide the interstitial identifier:

BidappBinding.Instance.ShowInterstitial(interstitialIdentifier);

Destroy with resource release

Call the following function to destroy interstitial:

BidappBinding.Instance.DestroyInterstitial(interstitialIdentifier);

DestroyInterstitial functions will also unregister all callback receiver instances, registered for the specified interstitialIdentifier

Callbacks / Delegates / Events

Register

To be able to register interstitial callbacks receiver you will need to inherit it from IBidappInterstitialDelegate

public class BidappInterstitialDelegate : IBidappInterstitialDelegate

Then you need to register receiver of the callbacks for interstitial instance identifier:

BidappSDKDelegate.Instance.SetInterstitialDelegate(
    new BidappInterstitialDelegate(), 
    interstitialIdentifier
);

Observe

You can observe ad loading events in callbacks:

public void OnInterstitialDidLoadAd(string identifier, string networkId)
{
    Debug.Log($"BIDUnity OnInterstitialDidLoadAd: interstitialId {identifier}, providerId: {networkId}");
}

public void OnInterstitialDidFailToLoadAd(string identifier, string networkId, string errorDescription)
{
    Debug.Log($"BIDUnity OnInterstitialDidFailToLoadAd: interstitialId {identifier}, providerId: {networkId}, errorDescription: {errorDescription}");
}

Events related to displaying interstitial ad can be observed in callbacks:

public void OnInterstitialDidDisplayAd(string identifier, string networkId)
{
    Debug.Log($"BIDUnity OnInterstitialDidDisplayAd: interstitialId {identifier}, providerId: {networkId}");
}

public void OnInterstitialDidClickAd(string identifier, string networkId)
{
    Debug.Log($"BIDUnity OnInterstitialDidClickAd: interstitialId {identifier}, providerId: {networkId}");
}

public void OnInterstitialDidHideAd(string identifier, string networkId)
{
    Debug.Log($"BIDUnity OnInterstitialDidHideAd: interstitialId {identifier}, providerId: {networkId}");
}

public void OnInterstitialDidFailToDisplayAd(string identifier, string networkId, string errorDescription)
{
    Debug.Log($"BIDUnity OnInterstitialDidFailToDisplayAd: interstitialId {identifier}, providerId: {networkId}, errorDescription: {errorDescription}");
}

public void OnInterstitialAllNetworksFailedToDisplayAd(string identifier)
{
    Debug.Log($"BIDUnity OnInterstitialAllNetworksFailedToDisplayAd: interstitialId {identifier}");
}

Release

If you don't want to receive callbacks anymore you can unregister callback receiver instance:

BidappSDKDelegate.Instance.SetInterstitialDelegate(
    null, 
    interstitialIdentifier
);

Last updated

Was this helpful?