AppBrain | AppLift SDK

Integration with Unity

This section describes how to integrate the AppBrain AppLift SDK into your Unity app and start monetizing it.

Unity integration steps

  • Download the AppLift SDK from the AppLift GitHub page
  • Open Unity with your project, e.g. “MyProject”
  • The Unity related files are in the AppLift SDK in the unity/ directory. Copy these files (Ads.cs, AppBrain.cs, AndroidManifest.xml, OfferwallButtonListener and appbrain-applift-sdk-VERSION.jar) to "MyProject"/Assets/Plugins/Android
  • Call AppLift functions where appropriate (see below)

If you use your own AndroidManifest.xml, please add the AppLift specific lines from our example file. Also add the following line to the Unity Player activity definition:

<meta-data android:name="unityplayer.ForwardNativeEventsToDalvik" android:value="true" />

The following example shows the use of AppLift functions in C# (see also main.cs).

using UnityEngine;
using System.Collections;
using AppLift;

public class main : MonoBehaviour {
    void Start () {
        AppBrain.Init();
    }

    void Update () {
        if (Input.GetKeyUp(KeyCode.Escape)) {
            AppBrain.GetAds().ShowInterstitial(true);
        }
    }
}

If you attach the main.cs script to one of the main objects (for instance the camera) of your main scene, you will then automatically get the interstitial on back press.

Creating a “More apps” button

If you create a Button in Unity you can attach the script OfferwallButtonListener to it. It needs a parameter myButton which you should set to the button, and then the button will open up the Offerwall when clicked. This use doesn’t require permission from us.

Please refer to the rest of the documentation for further instructions on how to use the SDK.