sanamionline
Aspiring developer
Profile
Posts: 61
Reg: Jul 22, 2012
Yulin, Guangxi
3,510
12/25/12 04:57 AM (13 years ago)

Adding LeadBolt Ads

I've contacted Leadbolt to see if I can get a very beginner reply but all they gave me is this: "The simplest way to run a Leadbolt ad unit in your App is to add the code in your App’s Activity class as seen by the example code below." What is the App's Activity Class? Example code below from LeadBolt Thank you /* Other imports here */ import com.pad.android.iappad.AdController; public class HelloWorld extends Activity { private AdController myController; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); myController = new AdController(this, "MY_LB_SECTION_ID"); myController.loadAd(); } public void onDestroy() { myController.destroyAd(); super.onDestroy(); } }
 
Sandeep
Android Fan
Profile
Posts: 1260
Reg: Feb 01, 2012
Miraj, India
25,250
like
12/27/12 12:21 PM (13 years ago)
An Activity is an android class. If you want to use an activity class, you must use extend Activity in your android project. An activity is the equivalent of a Frame/Window in GUI toolkits. It is not a file or a file type it is just a class that can be extended in Android for loading UI elements on view. In bt projects there are 2 classes which extend to activity. They are BT_activity_root.java and BT_activity_base.java files. Check line number 43 and 59 in those respective java files. You will see that both these files extend to activity. Check out the following link to understand the activity. http://developer.android.com/reference/android/app/Activity.html In case of adding leadbolt codes, i would suggest you add the above code in the BT_activity_base.java file because most of the plugin files extend to the BT_activity_base file.
 
Sandeep
Android Fan
Profile
Posts: 1260
Reg: Feb 01, 2012
Miraj, India
25,250
like
12/27/12 12:28 PM (13 years ago)
Add the above codes in following manner: Add following code in line 42: import com.pad.android.iappad.AdController; line 54: private AdController myController; line 63: myController = new AdController(this, "MY_LB_SECTION_ID"); myController.loadAd(); line 132: myController.destroyAd(); super.onDestroy(); Remember I have given the line numbers of the default bt_activity base file. When you add any line of code it will increase the numbers of line. Also in line 63 remember to place the "MY_LB_SECTION_ID" with your leadbolt id number which may be either numeric or alphanumeric. And also dont forget to add the leadbolt sdk in the libs folder. Yes, there is lib folder in bt project file, you can remane it to libs and add the sdk to it. After adding it dont forget to add a build path to that sdk.
 
sanamionline
Aspiring developer
Profile
Posts: 61
Reg: Jul 22, 2012
Yulin, Guangxi
3,510
like
12/27/12 07:19 PM (13 years ago)
Thank you for your reply. I've entered the code but in the BT_activity_base.java, AndroidManifest and added the jar SDK but all I get are errors. Wherever I entered the code above eclipse just said those areas were errors.
 
Sandeep
Android Fan
Profile
Posts: 1260
Reg: Feb 01, 2012
Miraj, India
25,250
like
12/27/12 07:32 PM (13 years ago)
I have not tried integrating leadbolt myself. But i think that @raveyd has done it. Contact him through PM and see whether he can help you. But before doing so, search on the forum for leadbolt tutorial he posted some time back.
 
sanamionline
Aspiring developer
Profile
Posts: 61
Reg: Jul 22, 2012
Yulin, Guangxi
3,510
like
12/27/12 07:50 PM (13 years ago)
Thanks
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.