Native Ads allow you to include ads in your App’s look and feel. Native Ad Integration is a more advanced integration for displaying ads and requires approval to run. If you are new to in-app ads, we recommend that you integrate our Interstitial ads and Video ads available here.

This page will show you how to integrate Leadbolt Native ads in your Android app. Download the SDK and native sample app using the link below. Make sure you can compile the sample app and see native test ads.

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

gstart


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.

To run native ads in your App, you will need to apply and be approved. Click on “Native Ads” link in the Publisher Portal or contact your account manager. Once approved, check that a “Native Ads” section is visible under your App. 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 Native Ads

Unzip the Leadbolt Android SDK zip files and copy the Leadbolt SDK jar file (AppTracker.jar) to your Android Project’s “libs” folder. Select “Copy files” when prompted.

androidstudio_screenshot1

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

Google Advertising ID

As of August 1st 2014, if your App is publishing onto the Google Play Store, our SDK will need to use the new Google Advertising ID. Please refer to the following official  documentation from Google on how to add the Google Play Services library to your Android Project.


Fetch Native Ads

To display a Native ad in your app, first you will need to fetch the ads via the SDK by using the “loadNativeAds” method of the AppTracker class. Using the ATNativeListener class, your app can be notified when Native ads have been fetched successfully. Please use the following code in your app. You will need to implement event listeners and request one of our supported ad sizes.

Native ad sizes: 1200×627, 320×480, 320×568, 768×1024, 120×120, 1024×768, 568×320, 480×320

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” in the Publisher Portal. Please remember, to run native ads in your App, you will need to apply and be approved. Click on “Native Ads” link in the Publisher Portal or contact your account manager. Once approved, check that a “Native Ads” section is visible under your App. Use the “Add Section” button if not visible.

Display Native Ads

Once a Native ad is fetched, you can display this Native ad to the user. The code below shows an example of how to display the Native ad via simple Android views. You can design views that match the look and feel of your App.


Obfuscating your App with ProGuard

If you are using ProGuard to obfuscate your release APK file, please add the following lines of code to your proguard configurations:

Troubleshooting

  • Native 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 as Test Ads are generally always available.
  • You should check your Publisher Portal and ensure the relevant native ad 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 native sample app provided to confirm any integration issues are SDK based.
  • The SDK has been tested to be compatible with Android Studio Version 2.2.1

gstart