Important: As an App developer, as the controller of data, you must ensure that you have received unambiguous and informed consent from a user before sharing any of their data with Leadbolt or before calling any Leadbolt SDK functions for that user. Please ensure your app is updated as required.

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


Before you begin Before you begin

  • Have you logged in to the Leadbolt Publisher Portal?
  • Did you add an App in the portal?
  • Ensure, you have downloaded the Leadbolt SDK and sample app from the link above

Step 1 Import Leadbolt SDK

Using Flash Professional
  • In your Flash Professional Project, select File -> Publish Settings.
  • Click the wrench icon next to Script for ActionScript settings. Select the “Library Path” tab, and click “Browse for Native Extension (ANE) File”, and browse to downloaded AppTrackerFlexLibrary.ane, then click open.
Using Adobe FlashBuilder/Flex
  • In your Flash Builder Project’s properties, select “Flex Build Path” section on the left-hand side column, then click the “Native Extensions” tab on the right-hand side. Click Add and browse to the downloaded AppTrackerFlexLibrary.ane file and then click OPEN.
  • Make sure “Update AIR application descriptor” is ticked, then click OK. You should now see AppTrackerFlexLibrary.ane listed under the Native Extensions tab. Click OK to finish.
  • Go to “Properties” -> “Flex Build Packaging”, select “Google Android” on the left-hand side column, and then click the “Native Extensions” tab. Make sure that the checkbox in the Package column of your native extension is checked. Click Apply.
  • Go to “Properties” -> “Flex Compiler”, then add “-swf-version=29” to “Additional compiler arguments:”
Using FlashDevelop
  • Copy the downloaded AppTrackerFlexLibrary.ane file to your FlashDevelop project folder.
  • In the explorer panel, right-click the “SWC” and select “Add To Library”
  • Right-click the SWC file in the explorer panel again, select “Options” and then select “External Library”

Step 2 Setup Leadbolt SDK

  • Add the required permission android.permission.INTERNET in your AndroidManifest.xml file
  • Add the required permission android.permission.ACCESS_NETWORK_STATE in your AndroidManifest.xml file
  • Add the required Leadbolt Activity in your AndroidManifest.xml
  • Add the ID of this extension (com.apptracker.AppTrackerANE) into your -app.xml.
  • For further information and reference refer to the SampleProject-app.xml attached in the downloaded Sample Project

Step 3 Initialize Leadbolt SDK

  • In your Project’s applicationCreated method add the following line to initialize the Leadbolt SDK.

Step 4 To Cache and Show a non-Rewarded Ad

  • To cache a non-Rewarded Ad
  • To show a non-Rewarded Ad
  • Please ensure that in your code, you do not call loadModule directly after loadModuleToCache. It will cause the SDK to fail and not display an Ad all together.
  • For Advanced SDK options, including use of Event Listeners, click here.

Step 5 To Cache and Show a Rewarded Ad

  • To cache a Rewarded Ad
  • To show a Rewarded Ad
  • Please ensure that in your code, you do not call loadModule directly after loadModuleToCache. It will cause SDK to fail and not display the Rewarded Ad at all.
  • To reward user, refer to the Advanced Integration on more information about Event Listeners and Rewarding Users

Step 6 Test your Integration

  • Run your Project on an Android device.
  • Ensure, test ads are displayed when the “loadModule” call is made in your App.
  • Once test ads are seen on your device, go to your Leadbolt Portal and set your App to “Live”
  • Once approved, you should see live ads in your App.

Congratulations! You have successfully integrated the Leadbolt SDK in your App

Troubleshooting 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 versions of Adobe Air: Apache Flex SDK 4.16.1, Adobe Air SDK version 29

Advanced Integration

Check Ad Availability Checking Ad Availability

Leadbolt SDK provides additional ability to the developers to check before hand if an Ad is available before displaying it to create a better user-experience in your App. To check if a Network or Direct Deal Ad is available please use the code below:

To check if a Rewarded Ad is available to be displayed, please use the code below:

Pass Additional Info 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

Event Listeners Using Event Listeners

With Event listeners, you can closely follow the ad states throughout your App. Leadbolt SDK will trigger events at all important stages of the Ad life-cycle. To implement event listeners in your App, you must implement the AppModuleDelegate class.

Setup SDK to use Event Listeners

Before you call the startSession() method, register the individual event listeners you wish to be notified of. You need to use the registerEventListeners() method as defined below:

Event Listener Methods


← Return to Help Center