Coding Guidelines

First of all you need to initialize ad manager. Best practise is to do this on your app start.

UM_AdManager.Init(); 

Banners

Banner ads use a small portion of the screen to entice users to "click through" to a richer, full-screen experience such as a website or app store page.

Following code snipped shows how simple you can create a banner view in your app.

int bannerId = UM_AdManager.CreateAdBanner(TextAnchor.UpperLeft);

The banner can be anchored using the TextAnchor Unity class.

The bannerId returned by CreateAdBanner method, can be used in order to control created banner instance with the following methods:

UM_AdManager.HideBanner(bannerId1);
UM_AdManager.ShowBanner(bannerId1);
UM_AdManager.RefreshBanner(bannerId1);
UM_AdManager.DestroyBanner(bannerId1);

or checking banner states:

UM_AdManager.IsBannerLoaded(bannerId1)
UM_AdManager.IsBannerOnScreen(bannerId1)

Interstitial

Star interstitial ad is fairly simple, all you have to do is to call:

UM_AdManager.StartInterstitialAd();

it will initialize interstitial request and interstitial will show up as soon as it’s loaded.

In order to implement more advanced interstitial ad mamagin, you may use following methods:

UM_AdManager.LoadInterstitialAd();
UM_AdManager.ShowInterstitialAd();

and events

public static event Action OnInterstitialLoaded 
public static event Action OnInterstitialLoadFail
public static event Action OnInterstitialClosed

Implementation example can be found bellow:

void Awake() {
		
	//subscribing to the Interstitial events
	UM_AdManager.OnInterstitialLoaded += HandleOnInterstitialLoaded;
	UM_AdManager.OnInterstitialLoadFail += HandleOnInterstitialLoadFail;
	UM_AdManager.OnInterstitialClosed += HandleOnInterstitialClosed;

	//pre-loading Interstitial content
	UM_AdManager.LoadInterstitialAd();
}


void HandleOnInterstitialClosed () {
	Debug.Log ("Interstitial Ad was closed");
	UM_AdManager.ResetActions();
}

void HandleOnInterstitialLoadFail () {
	Debug.Log ("Interstitial is failed to load");
	UM_AdManager.ResetActions();
}

void HandleOnInterstitialLoaded () {
	Debug.Log ("Interstitial ad content ready");

	//Content was loaded, we can now show the Interstitial ad.
	UM_AdManager.ShowInterstitialAd();
}

 

Full use example can be founded at UM_AdExample.cs script.