Advertiser Campaign SDK Your How-to Guide Using Leadbolt Advertiser Campaign SDK with Android Apps Version: Adv2.03 Copyright 2012 Leadbolt All rights reserved
Disclaimer This document is provided as-is. Information and views expressed in this document, including URL and other Internet Web site references, may change without notice. You bear the risk of using it. This document does not provide you with any legal rights to any intellectual property in any Leadbolt product. You may copy and use this document for your internal, reference purposes. 2012 Leadbolt. All rights reserved. Android is a trademark of the Google Inc. All other logos and trademarks are the property of their respective trademark owners. Copyright 2012. Leadbolt. All rights reserved Page 2 of 6
Adding Leadbolt Tracking to your Android App Setting up a Leadbolt campaign Step 1: Set up your campaign This is done in the Leadbolt advertiser portal at http://www.leadbolt.com. Create your new campaign with the relevant settings and then click the campaign Get Code icon to retrieve the App SDK Tracking ID and Campaign Secret Key. Step 2: Get the Advertiser Campaign SDK files You can get the Advertiser Campaign SDK from the Leadbolt Advertiser portal FAQ including this guide. You will need to add these files into your App Project directory as indicated in the next section. Please ensure you have the Advertiser Campaign SDK version 2.03 package or greater. Copyright 2012. Leadbolt. All rights reserved Page 3 of 6
Setting up the Android Development Environment Getting Started It is recommended that you use the Eclipse IDE with the ADT Plugin to build your Android Apps: o Once a new project a created, make sure there a libs folder exists in your Project. o If not, simply right-click on the Project and click New -> Folder and enter libs as the Folder name Linking in the Required Library To link the Leadbolt Advertiser Campaign SDK as a static library you will need to do the following: Step 1: Modifying Permissions The following permissions are required for the Ad conversions to be recorded: INTERNET ACCESS_NETWORK_STATE READ_PHONE_STATE Make sure that these are defined in your Project s AndroidManifest.xml file <uses-permission android:name="android.permission.internet"> <uses-permission android:name="android.permission.access_network_state"> <uses-permission android:name="android.permission.read_phone_state" /> Copyright 2012. Leadbolt. All rights reserved Page 4 of 6
Step 2: Add the Leadbolt Advertiser Campaign SDK To add the Leadbolt Advertiser Campaign SDK as a static library, follow these steps: 1. In the Eclipse IDE, simply drag the trxcam.jar file into your Project s libs folder. 2. When prompted Select how files should be imported into the project: and tick Copy Files option and click OK 3. Then, right-click on your Project and click Build Path -> Configure Build Path. 4. Under the window displayed, select Libraries tab. Click Add JARs, then select the trxcam.jar file from the libs folder of your Project. Copyright 2012. Leadbolt. All rights reserved Page 5 of 6
Integrating the Advertiser Campaign SDK Adding a Leadbolt tracker to your App codebase The simplest way to run a Leadbolt Advertiser Campaign SDK in your App and track your conversions is to add it in your App s Activity as seen by the example code below: import com.trx.android.lbtracker; public class HelloWorld extends Activity { private LBTracker mytracker; public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); mytracker = new LBTracker (this, "LB_CAMPAIGN_TRACK_ID", "CAMPAIGN_SECRET_KEY"); mytracker.loadtracker(); } } When including this code be sure to place the values for LB_CAMPAIGN_TRACK_ID and CAMPAIGN_SECRET_KEY retrieved earlier for the campaign. Copyright 2012. Leadbolt. All rights reserved Page 6 of 6