This page will show you how to integrate Leadbolt Video and Interstitial ads in your Android app using Phonegap / Cordova. 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


Before you begin Before you begin

  • Have you signed up and 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
  • To get Direct Deal Ads in your App, click on “Direct Deals” link in the Publisher Portal and click on the Apply button.
  • To run Rewarded Ads in your App, you will need to apply and be approved. Click on “Rewarded Ads” link in the Publisher Portal to apply or contact your account manager.

Step 1 Add Leadbolt Plugin

  • To install the Leadbolt Phonegap plugin, execute the following command: “phonegap local plugin add <YOUR_LEADBOLT_PLUGIN_PATH> “. Replace the path with the actual path of the downloaded and unzipped path.

Step 2 Initialize the Leadbolt SDK

  • In your App’s HTML file add the following lines to the onDeviceReady function

    You will need to replace "YOUR_APP_API_KEY"  with the specific api key for your app (include the double quotes).

Step 3 To Cache and Show a non-Rewarded Ad

To get Direct Deal Ads in your App, click on “Direct Deals” link in the Publisher Portal and click on the Apply button.

  • 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 4 To Cache and Show a Rewarded Ad

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

  • 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


Test Integration 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: Cordova version 6.5.0

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, add the following lines of code to your Javascript code


gstart


← Return to Help Center