AppLift SDK

Report 0 Downloads 161 Views
AppLift SDK 1.0 Unity Integration

AppLift SDK Unity iOS/Android Integration Guide

Prepared by the AppLift Engineering Team © 2012-2013 AppLift GmbH. All rights reserved.

AppLift SDK 1.0 Unity Integration

Introduction and Table of Contents

Unity Plugin The AppLift Unity Plugin provides integration of the engagement interstitials. It is provided in the form of a unitypackage that you may simply include in your project. Our SDK is compatible with both iOS and Android platforms.

Contents 1.

Installation

2.

Configuration

3.

Deploying to Android

4.

Deploying to iOS

AppLift SDK 1.0 Unity Integration

Installation 1. Download the “AppLift_Unity_SDK.unitypackage” 2. Open your project in Unity, select the “Assets” menu, select “Import Package”

3. Make sure to select everything in the “Items to Import”

AppLift SDK 1.0 Unity Integration

Important for Android Games 1. Package Contents If you already have any imported android plugins in your Unity project, do not overwrite the content of your Assets/Plugins/Android/ folder with the stuff from the unitypackage we provide you. You should merge them instead. Carefully update your existing Manifest.xml, check if the next entries are presented:

<uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> <uses-permission android:name="android.permission.READ_PHONE_STATE" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />



2. Compatibility with Unity 4.0.x (< 4.1.x) If you are not using the Unity 3D SDK 4.1.x or higher, you will probably need to download and install Android SDK rev21 as the Android SDK rev22 conflicts with the older Unity versions. After installation do not forget to download the API platforms you need via Android SDK Manager.

At this point, the Unity interface to the AppLift SDK is imported in your game containing also the native AppLift SDK for Android. For iOS, the native AppLift SDK should be include in Xcode after you exported the project from Unity.

AppLift SDK 1.0 Unity Integration

Configuration 1. By default, the AppLift SDK is not active, to start it call: AppLiftSDKInterface.appliftStartForAppWithSecret("app_id", "app_secret");

Note: The

app_id

and app_secret are provided separately for iOS and Android. You can implement

multipurpose initialization block writing the code: #if UNITY_IPHONE AppLiftSDKInterface.appliftStartForAppWithSecret

("iOSAppID", "iOSAppToken");

#elif UNITY_ANDROID AppLiftSDKInterface.appliftStartForAppWithSecret

("AndroidAppID",

"AndroidAppToken"); #endif For convenience call this line as early as possible in your game, to accomplish the initialization process before any Ad triggering. 2. To open an interstitial, your button should call: ApLiftSDKInteface.appliftRequestInterstitialViewOfType(AppLiftInterstitialType.AppL iftInterstitialTypeSmart );

The available

AppLiftInterstitialType

is:

AppLiftInterstitialTypeSmart

3. The AppLiftSDKInterface is implementing two callback methods: public void OnRequestSucceeded(string status); public void OnRequestFailed(string status);

and converting the callback string to the AppLiftStatus enum: AppLiftStatusAdDownloaded AppLiftStatusAdShown AppLiftStatusNoInterstitialAvailable AppLiftStatusNetworkError AppLiftStatusTimeoutError AppLiftStatusInvalidToken AppLiftStatusClosed AppLiftStatusNotInitialized AppLiftStatusInterstitialTypeNotActive AppLiftStatusResourceNotAvailable

You can use this statuses to put your game in pause, then restart it again.

AppLift SDK 1.0 Unity Integration

Deploying to Android In your Unity project go to File menu, select Build Settings, open Android section

Here you can specify your own android project’s settings and build or run your application with the AppLift SDK in it.

AppLift SDK 1.0 Unity Integration

Deploying to iOS In your Unity project go to File menu, select Build Settings, open iOS section

Once you have your Xcode project, follow the native iOS integration guideline.