Skip to content

iOS InApp Unity Documentation

yanivav edited this page Jun 23, 2014 · 27 revisions

Last SDK Version: 2.1.1

This document describes the basic procedure for integrating StartApp In-App Ads into your Unity applications for iOS.
After this simple integration process, StartApp In-App Ads enables you to reap the benefits of StartApp's In-App monetization products, which maximize the revenue generated by your application. All this profit-making is achieved with minimal effort and minimal interference with your users’ experience.

NOTES:

  • To build your app with StartApp SDK you must have XCode 4.4.1+
  • The code samples in this document can be copy/pasted into your source code
  • Please notice that steps 1-3 are mandatory
  • If you have any questions, contact us via support@startapp.com


##Step 1, Adding the SDK package to your Unity project In order to add StartApp SDK to your application please follow the following steps:

1. Unzip all files to a temporary folder
2. Import StartAppAndroidUnitySDK-x.x.x.unitypackage as a Custom Package (or drag and drop it to your "Assets" folder under the "Project" Window)

TBD - screenshot

Back to top


##Step 2, Updating your StartApp data file Update the StartAppDataiOS.txt_ (in the Assets/Resources folders) as follows:

1. Add your StartApp Developer ID after "developerId="
2. Add your StartApp Application ID after "applicationId="

You can find your Developer and Application IDs in the developers’ portal.
After logging in, your developer ID will be at the top right-hand corner of the page:

To find your application ID, click on the at the top of the main screen and then choose the relevant ID from your app list:

Back to top


##Step 4, Adding an exit ad to your project

Use the StartAppBackPlugin in components where you would like the user to press 'back' to exit the application. The plugin will show an ad and then exit the application.

1. Drag the StartAppBackPlugin.cs to the components which you would like pressing 'back' to exit the application
2. Do not implement exit on the 'back' in this components

NOTE: there is no need to implement exit on the 'back' button in these components as the plugin will exit the application after showing the ad.

Back to top


##Step 5, Showing Banners 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 () {
     StartAppWrapper.addBanner( 
           StartAppWrapper.BannerType.AUTOMATIC,
	       StartAppWrapper.BannerPosition.BOTTOM);
}

Parameters

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

If you wish to add a specific type of banner, please refer to the Advanced Usage.

Back to top


##Step 6, Showing Interstitial Ads

You can choose to show the interstitial ad in several locations within your application. This could be upon entering (onCreate), between stages, while waiting for an action and more.

We do, however, recommend showing the ad upon exiting the application by using the ‘Back’ button or the ‘Home’ button, as explained in step 4 above.

Add the following code to the appropriate place or places within your activities in which you would like to show the ad:

1. Import the sdk namespace

using StartApp;

2. Load the ad

void Start () {
StartAppWrapper.loadAd();
}

3. Show the ad

StartAppWrapper.showAd();
StartAppWrapper.loadAd();

Back to top

##Advanced Usage For advanced usage, please refer to the ["Advanced Usage"](unity-android-advanced-usage) section.

Back to top

Clone this wiki locally