This page will show you how to integrate Leadbolt Video and Interstitial ads in your Android app using Unity. Download the SDK and sample app. Make sure you can compile the sample app and see test ads.

To get started sign up for a Leadbolt Publisher account here or login to the Publisher Portal here.

gstart for Unity v5. For a sample for Unity v4.7, click here.


Add your apps

Login to the Publisher Portal and select the ‘Create New App’ button from the “Apps” page. Fill in your app’s details including name and platform. Once app is added, it is recommended that you also apply for our premium deals by clicking “Direct Deals” in the Publisher Portal. Once approved, a “Direct Deals” section should be visible under your app in the Publisher Portal. Use the “Add Section” button if not visible.

 


Copy Your Integration Details

Your integration details will be displayed on the last page of the Create App process. These integration details will be needed when you integrate the Leadbolt SDK into your app.

Create App Dialogue-3


Integrating Leadbolt SDK

Firstly test the sample project attached with the plugin. Simply open the MainScene.unity  file from the Sample App -> Assets folder. Open Build Settings and select Android and click “Build and Run”. Once the build process is complete and App is running on your Device confirm that Leadbolt test ads are showing correctly.

Once Sample app is confirmed working, you can start integrating the plugin into your app. Firstly to import the required files, unzip the downloaded plugin and in the Unity IDE, click on “Assets -> Import Package -> Custom Package”. Select the leadbolt_android_unity.unitypackage  file. Select all files in that plugin to import.

Once files are imported, you will see the AppTrackerAndroid under Assets. Drag and drop the AppTrackerAndroid.prefab  object to your main scene.

Add the required permissions to your app’s AndroidManifest.xml  file:

Add the required Leadbolt Activity in your AndroidManifest.xml  file just before the </application>  tag:

Using Network Ads and Direct Deals

Open your C# file and add the following lines of code in there. This code uses the Auto recaching option to fetch a new Ad automatically – no additional coding required.

You will need to replace  "YOUR_APP_API_KEY" with the specific api key for your app (include the double quotes). This is available in the settings menu for your app, under the option “Get App API Key”. To get Direct Deal Ads in your App, click on “Direct Deals” link in the Publisher Portal and click on the Apply button. If your app includes audio or background audio, please ensure you pause audio during ad display.

Passing additional information

You can increase your App’s performance by optionally including the additional information below. This allows selected premium advertisers to display their Ads to your users. To pass this additional information, use the following methods BEFORE calling loadModuleToCache


Using Rewarded Video

To run rewarded video in your App, you will need to apply and be approved. Click on “Rewarded Videos” link in the Publisher Portal to apply or contact your account manager.

When implementing “Rewarded Videos”, please make use of the following code in your App that displays a rewarded video and triggers a client side event listener when the user has watched the video. Check that a “Rewarded Video” section is visible under your app in the Publisher Portal. Use the “Add Section” button if not visible. Contact your account manager if you require a server side postback when the user has watched the video. If your app includes audio or background audio, please ensure you pause audio during ad display.

Please use the following code in your App. This code uses the Auto recaching option to fetch a new Ad automatically – no additional coding required.

You will need to replace  "YOUR_APP_API_KEY" with the specific api key for your app (include the double quotes). This is available in the settings menu for your app, under the option “Get App API Key”.

Passing additional information

You can increase your App’s performance by optionally including the additional information below. This allows selected premium advertisers to display their Ads to your users. To pass this additional information, use the following methods BEFORE calling loadModuleToCache


Implementing Event listeners in your App

With Event listeners, you can be notified of the specific events during the Ad life-cycle. To implement event listeners in your App, first add the following lines to your Start()  method:

Add the following methods to your C# file to be notified of the events:

Troubleshooting

  • Video and Interstitial Ads may not be available at all times in all countries. It is always best to test with your App in Test Mode in the Publisher Portal to ensure as Test Ads are generally always available.
  • You should check your Publisher Portal and ensure the relevant section is visible under your App. Use the “Add Section” button to add if not available.
  • You should check the SDK logs located in Logcat logs with the Tag “AppTracker”.
  • Always test the sample app provided to confirm any integration issues are SDK based.
  • This plugin has been tested on the following version of Unity IDE: 4.7.2f1 and 5.5.1f1

gstart for Unity v5. For a sample for Unity v4.7, click here.

← Return to Help Center