Skip to content

Unity Android Advanced Usage

StartApp edited this page Jul 14, 2014 · 7 revisions

######This section describes advanced usage and personal customization options and is not mandatory for the integration.

##Selecting Banner Type There are 3 different types of banners:
Banner Type Description
Automatic Banner (Recommended) Automatic selects the most suitable banner of the two listed below
Standard (2D) Banner A standard (two dimensional) banner
3D Banner A three dimensional rotating banner

We highly recommend adding an Automatic banner, which automatically selects whether to display a standard banner or a 3D banner. The banner remains displayed throughout the entire activity life-cycle.

To add a banner to your application add the following code in the appropriate place:

1. Import the SDK namespace

using StartApp;

2. Display the banner

void Start () {
     #if UNITY_ANDROID
     StartAppWrapper.addBanner( 
           StartAppWrapper.BannerType.AUTOMATIC,
	       StartAppWrapper.BannerPosition.BOTTOM);
     #endif
}

Parameters

BannerType - type of banner. Can receive one of the following:
StartAppWrapper.BannerType.AUTOMATIC
StartAppWrapper.BannerType.STANDARD
StartAppWrapper.BannerType.THREED

BannerPosition - position of the banner. Can receive one of the following:
StartAppWrapper.BannerPosition.BOTTOM
StartAppWrapper.BannerPosition.TOP

Back to top

##Adding a callback when Ad has been loaded

StartAppWrapper.loadAd() can get an implementation of AdEventListener as a parameter. In case you want to get a callback for the ad load, pass the object which implements StartAppWrapper.AdEventListener as a parameter to the method. This object should implement the following methods:

public void onReceiveAd(){
}
public void onFailedToReceiveAd(){
}
##Adding a callback when Ad has been shown

StartAppWrapper.showAd() can get an implementation of AdDisplayListener as a parameter. In case you want to get a callback for the ad show, pass the object which implements StartAppWrapper.AdDisplayListener as a parameter of the method. This object should implement the following methods:

public void adHidden(){
}
public void adDisplayed(){
}

Back to top

Clone this wiki locally