Coding Guidelines

Maker sure that InApp purchases Setup Guide is complete.

 

Before using AdvertisingAPI, we need to init SA_AmazonAdsManager. We can also subscript for alavalible events before initing.

SA_AmazonAdsManager.instance.OnBannerDataReceived += OnBannerDataReceived;
SA_AmazonAdsManager.instance.OnBannerCollapsedResult += OnBannerCollapsedResult;
SA_AmazonAdsManager.instance.OnBannerDismissedResult += OnBannerDismissedResult;
SA_AmazonAdsManager.instance.OnBannerExpandedResult += OnBannerExpandedResult;

SA_AmazonAdsManager.instance.OnInterstitialDataReceived += OnInterstitialDataReceived;
SA_AmazonAdsManager.instance.OnInterstitialDismissed += OnInterstitialDismissed;

 

Here is parse example of those events.

 

OnBannerDataReceived action will tell us about full info of your Banner. If you successfully catch this event, your banner should be displayed on the device screen.

private void OnBannerDataReceived (AMN_BannerDataResult result) {
	AMN_AdProperties properties = result.Properties;

	Debug.Log("OnBannerDataReceived with result success " + result.isSuccess);
}

AMN_AdProperties has all the information about your banner:
 

	private bool _canExpand;
	private bool _canPlayAudio;
	private bool _canPlayVideo;
	private string _adtype;

	public AMN_AdProperties(bool canExpand, bool canPlayAudio, bool canPlayVideo, string adtype) {
		CanExpand = canExpand;
		CanPlayAudio = canPlayAudio;
		CanPlayVideo = canPlayVideo;
		Adtype = adtype;
	}


The remaining 3 events associated with banner have only error message that comes when triggered the event.

void OnBannerCollapsedResult (AMN_BannerCollapsedResult result) {
	message = result.Error_message;
}

void OnBannerDismissedResult (AMN_BannerDismissedResult result) {
	message = result.Error_message;
}

void OnBannerExpandedResult (AMN_BannerExpandedResult result) {
	message = result.Error_message;
}

 

OnInterstitialDataReceived action will tell us about full info of your interstitial. If you successfully catch this event, your interstitial should be displayed on the device screen.

private void OnInterstitialDataReceived (AMN_InterstitialDataResult result) {
	AMN_AdProperties properties = result.Properties;
		
	Debug.Log("OnInterstitialDataReceived with result success " + result.isSuccess);
}

AMN_AdProperties has the same info as banner.

The remaining event associated with interstitial have only error message that comes when triggered the event.

private void OnInterstitialDismissed (AMN_InterstitialDismissedResult result) {
	message = result.Error_message;
}

 

Methods of working with advertising

 

CreateBanner action will create banner with the preferred position(you can set position in Inspector of class):

SA_AmazonAdsManager.instance.CreateBanner(GetPosition());

 

RefreshBanner action will refresh your banner:

SA_AmazonAdsManager.instance.RefreshBanner();

Note: By default we have 30 second interval updates advertising.

 

HideBanner action will hide or show your banner(It has bool param):                

SA_AmazonAdsManager.instance.HideBanner(hide);

 

LoadInterstitial action will load interstitial.

SA_AmazonAdsManager.instance.LoadInterstitial();

Note: That method just load interstitial ad, it will not show ad.

 

ShowInterstitial action will show interstitia adl.

SA_AmazonAdsManager.instance.ShowInterstitial();