B4A Library Leadbolt Ads

pluton

Active Member
Licensed User
Longtime User
LeadBolt Instructions New Library

Ok
This is for new users and anyone which don't know how work with LeadBolt.
So here it is

LeadBolt Basic4Android library - version 1.4

Requirements
------------

1. You must have a basic4android account that allows inclusion of 3rd party libraries (Basic4android (Basic for Android) - Rapid Application Development)

2. You must have a LeadBolt app publisher account (http://www.leadbolt.com) <- my referal link for developers

3. You must have accessed your leadbolt account to register your android app and have created ads, retrieved the relevant section ids.

4. From the help/faq section of the leadbolt portal, you must have downloaded the latest (version 2.0 and above) LeadBolt android publisher SDK (LeadboltController.jar contained in SDK zip).

Integration
------------
The following needs to be completed in the basic4android IDE


1. Unzip the LB_basic4android_lib.zip file and copy all unzipped files (including the *.xml files) to the additional libraries path of the Basic4Android IDE.
2. Copy Leadbolt native library jar files to the same folder as above one.
3. In the Basic4Android IDE, add references to library pubiapp.jar, pubxappCom.jar, LeadboltIWrapper.jar and LeadboltXWrapper.jar in your project. (see image 01)


In this image stands also old LeadBolt library. That is marked with green color. You don't need it anymore so you can delete it from library.

4. Add the relevant code to display LeadBolt ads within your app. Following is the typical code for adding ads to your Basic4Android project:

B4X:
'Activity module
Sub Process_Globals
   'These global variables will be declared once when the application starts.
   'These variables can be accessed from all modules.

End Sub

Sub Globals
   'These global variables will be redeclared each time the activity is created.
   'These variables can only be accessed from this module.

   Dim iLeadbolt As LeadboltIWrapper
   Dim xLeadbolt As LeadboltXWrapper
End Sub

Sub Activity_Create(FirstTime As Boolean)
   Activity.LoadLayout("Main")
   
   'for banner, unlocker and capture form ads
   iLeadbolt.Initialize("LeadboltI")
   iLeadbolt.setListener()      
   iLeadbolt.loadLeadboltAds("YOUR_SECTION_ID")  

   'for notification and icon ads
   'set xLeadbolt.ADS_NOTIFICATION for notification ads, and
        'xLeadbolt.ADS_ICON for icon ads.
   xLeadbolt.Initialize("LeadboltX")
   xLeadbolt.setListener()      
   xLeadbolt.loadLeadboltAds("YOUR_SECTION_ID", xLeadbolt.ADS_NOTIFICATION) 
   
End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)
   
End Sub

'4. This SDK also supports event listener For Ads loading. To implement event callbacks, call adLeadbolt.setListener() before loading your ads AND implements following Sub:

'for banner, unlocker and capture form ads event
Sub LeadboltI_AdClicked

End Sub

Sub LeadboltI_AdClosed

End Sub

Sub LeadboltI_AdCompleted

End Sub

Sub LeadboltI_AdFailed

End Sub

Sub LeadboltI_AdLoaded

End Sub

Sub LeadboltI_AdProgress

End Sub

Sub LeadboltI_AdAlreadyCompleted

End Sub

Sub LeadboltI_AdHidden

End Sub

'for notification event
Sub LeadboltX_AdPause

End Sub

Sub LeadboltX_AdResume

End Sub

5. In "Activity Properties" of the Basic4Android IDE Project menu, untick "Full Screen" and "Include Title".


6. In the Basic4Android IDE, Tick "Do Not Overwrite Manifest File" in Project menu.


7. Open YourProject/Objects/AndroidManifest.xml file, add
B4X:
<receiver android:name="com.Leadbolt.AdNotification" />

set
B4X:
android:anyDensity="false"
and save
9. Add following code to this AndroidManifest.xml file:
B4X:
<uses-permission android:name="android.permission.INTERNET"/>
   <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
   <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
   <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
   <uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS"/>
   <uses-permission android:name="android.permission.READ_PHONE_STATE"/>
   //for notification ads.
   <uses-permission android:name="android.permission.WAKE_LOCK" />
   //for icon ads.
   <uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT" />
   <uses-permission android:name="com.android.browser.permission.WRITE_HISTORY_BOOKMARKS"/>
   //for capture form ads.
   <uses-permission android:name="android.permission.GET_ACCOUNTS" />

and
B4X:
<receiver android:name="com.pad.android.xappad.AdNotification"/>
to your application tag.

10. Run your application in the Basic4Android emulator to check you see LeadBolt test ads.

Image1 (When user start app for first time it shows Toastmessage from Leadbolt)
Image2 (This is how app look with 4 ads showing it)
Image3 (This is how look notification from LeadBolt ads)



EDIT: Updated SDK to 3.06b version 13.09.2012

Added in attachments of this post:
lb_android_sdk_basic4android_v1.04.zip
  • LeadboltIWrapper.jar
  • LeadboltXWrapper.jar
  • LeadboltIWrapper.xml
  • LeadboltXWrapper.xml
  • pubiapp.xml
  • pubxappCom.xml
  • readme.txt
lb_android_sdk_iapp_v3.06a.zip
  • pubiapp.jar
lb_android_sdk_pubxappCom_v3.06a.zip
  • pubxappCom.jar
lb_android_sdk_xapp_v3.06a.zip
  • pubxapp.jar
 

Attachments

  • lb_android_sdk_basic4android_v1.04.zip
    9 KB · Views: 325
  • lb_android_sdk_iapp_v3.06b.zip
    59.7 KB · Views: 302
  • lb_android_sdk_pubxappCom_v3.06b.zip
    18.2 KB · Views: 295
  • lb_android_sdk_xapp_v3.06b.zip
    41.8 KB · Views: 284
Last edited:

uswin4224

Member
Licensed User
Longtime User
Thanks a lot pluton.
Your instruction is top notch. Surely this will be a big help for basic4android newbie such as me.

Cheers
Aswin
 

pluton

Active Member
Licensed User
Longtime User
Hi everyone

I have edited tutorial post here and updated SDK files to version 3.06b

What's new in SDK 3.06b

This SDK release includes small updates requested by users for the EULA. Integration and available function calls remain the same. This release adds small changes to timing and performance.
We recommend updating to this version.
 

uswin4224

Member
Licensed User
Longtime User
Hi Pluton, does this latest SDK 3.06b already implemented User EULA loadOptin() function to show user the APP EULA at the start of the app ?

If it is already implemented, can you show us how to do this ?

Thanks.
 

pluton

Active Member
Licensed User
Longtime User
Hi Pluton, does this latest SDK 3.06b already implemented User EULA loadOptin() function to show user the APP EULA at the start of the app ?

If it is already implemented, can you show us how to do this ?

Thanks.

As you see on pictures when you start app with leadbolt ads it says notification about leadbolt ads and Optin.

If you go to:
B4X:
http://x.ldbt.net/
http://opt.leadbolt.com/

You can also see this Leadbolt version "stackoverflow" FAQ here
LeadBolt Q&A Forum

For version 3.06b I see only this description:
This release adds small changes to timing and performance
 

uswin4224

Member
Licensed User
Longtime User

Sorry, what I mean is, how can i show this leadbolt EULA like this using the newest leadbolt SDK ? is this achievable using basci4android ? I read this EULA from their PN documentation.

 

DannyRyan

Member
Licensed User
Longtime User
Hi, Can anyone help?
I created a blank app in B4A to try this LeadBoltAds lib, but every time i try i get a blank black screen followed a few seconds later with an error "Unfortunately, <appname> has stopped."

I thought it was related to the SectionID
have tried
iLeadbolt.loadLeadboltAds(123456789)
and
iLeadbolt.loadLeadboltAds("123456789")

Does anyone have a blank project with the Ads working I could compare to see where i am going wrong?

Additional, how do i say where i want the ad displayed(top middle bottom etc). I can not find a view in the designer for the advert?

Thanks

Danny
 

DannyRyan

Member
Licensed User
Longtime User
Hi Erel,

here is the log

LogCat connected to: B4A-Bridge: samsung GT-I9100-355310044076119
--------- beginning of /dev/log/main
--------- beginning of /dev/log/system
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
** Service (service1) Create **
** Service (service1) Start **
Connected to B4A-Bridge (Wifi)
Installing file.
** Activity (main) Pause, UserClosed = false **
PackageAdded: package:com.drapps.testleadboltads
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (main) Resume **
Installing file.
** Activity (main) Pause, UserClosed = false **
PackageAdded: package:com.drapps.testleadboltads
** Activity (main) Create, isFirst = true **
main_activity_create (B4A line: 21)
iLeadbolt.Initialize("LeadboltI")
java.lang.NoClassDefFoundError: com.pad.android.util.AdLog
at leadbolt.b4a.iwrapper.ILeadbolt.Initialize(ILeadbolt.java:38)
at com.drapps.testleadboltads.main._activity_create(main.java:218)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:170)
at com.drapps.testleadboltads.main.afterFirstLayout(main.java:84)
at com.drapps.testleadboltads.main.access$100(main.java:16)
at com.drapps.testleadboltads.main$WaitForLayout.run(main.java:72)
at android.os.Handler.handleCallback(Handler.java:605)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4507)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:790)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:557)
at dalvik.system.NativeStart.main(Native Method)
** Activity (main) Resume **
 

pluton

Active Member
Licensed User
Longtime User
Hi

@DannyRyan
Did you add in the Basic4Android IDE references to library pubiapp.jar, pubxappCom.jar, LeadboltIWrapper.jar and LeadboltXWrapper.jar in your project.

@uswin4224
I think you can make your own splash screen with this EULA. Later I will make a example and put it here in attachment.
 

DannyRyan

Member
Licensed User
Longtime User
@Pluton
Got it working, thank you!

I was missing the pubiapp & pubxappcom libs, present in the IDE but not selected.
I know why i went wrong, i originally installed the libs from the 1st page of this thread, and later downloaded and installed the libs from page 27.. as some of the libs are differently named i was unticking the wrong ones.

Old libs removed completely now and only the new libs on machine.

Thanks again

DAnny
 

pluton

Active Member
Licensed User
Longtime User
As I promise last week I have made a small example of showing EULA Splash screen for LeadBolt

It is only SplashScreen with Accept or Not EULA rules.

If user choose Skip the app exit
If user choose Accept - app remember user choice and Don't show again EULA so user can use the app

And I recommend also to read some Q&A on Leadbolt version of StackOverlow

Link: LeadBolt Q&A Forum

Project is in attachment and here is a little screenshot:
 

Attachments

  • LeadBolt_EULA_example_(Only SplashScreen).zip
    11.6 KB · Views: 247

tamadon

Active Member
Licensed User
Longtime User
Do I have to connect the splash screen with my section ID? If so how do I do that ( loadOptin function?)? Or just use the code independently of leadbolt?
 
Last edited:

tamadon

Active Member
Licensed User
Longtime User
I noticed there are some changes to the code so I changed my code to the following
B4X:
Sub Globals

    Dim LeadboltNoti, LeadboltIcon As LeadboltXWrapper 'Used for both notification and icons
   'Dim xxx  As LeadboltIWrapper 'This is not used?
End Sub

Sub Activity_Create(FirstTime As Boolean)
   Activity.LoadLayout("main")   
   
   LeadboltNoti.Initialize("LeadboltNoti")
    LeadboltNoti.setListener()
   LeadboltNoti.ADS_NOTIFICATION
    LeadboltNoti.loadLeadboltAds("xxxxxxx") 
   
   LeadboltIcon.Initialize("LeadboltIcon")
    LeadboltIcon.setListener()       
   LeadboltIcon.ADS_ICON
    LeadboltIcon.loadLeadboltAds("xxxxxxx")

....

Is this format correct?
 

tamadon

Active Member
Licensed User
Longtime User
The previous code gave me missing parameters error, so I changed it to

B4X:
   LeadboltNoti.Initialize("LeadboltNoti")
    LeadboltNoti.setListener()
    LeadboltNoti.loadLeadboltAds("xxxxxx", LeadboltNoti.ADS_NOTIFICATION ) 
   
   LeadboltIcon.Initialize("LeadboltIcon")
 LeadboltNoti.setListener()
    LeadboltIcon.loadLeadboltAds("xxxxxx", LeadboltIcon.ADS_ICON)
 
Last edited:

uswin4224

Member
Licensed User
Longtime User
Well,

Doesn't mean to be rude or anything, my leadbolt account has just been banned for 1 week, and when leadbolt ask me to verify again by sending the scanned identity, my approval is denied. thus basically I am kicked out of leadbolt for no reason.

This is occur when I first upload my 3 app in to the market, and then set the real mode to on, next time in the morning, my account has been banned for no reason.

It seem that I just got picked randomly by their security system, this is indeed sad news for a new publisher like me that just starting to make a name in the market.

Just keep aware of this advertising network, never 100% trust an ad network.
And make sure that no one is trying to click fraud your ads or something.

Anyway, thanks for the EULA implementation though.

:sign0148:
 

capisx

Member
Licensed User
Longtime User
same as uswin4224, my leadbolt account has just been banned in the end of last month without any clarity. They say, they have recently introduced some new security measures designed to help protect their clients on the network. Then they ask me to verify again by sending the scanned identity, and after i've sent the documents they send a reply email today stating that my account will not be re-activated. In that email they don't explain to me what is wrong.

This month I should be able to claim my first earning ($100) after 10 months to earn that :sign0148: . It's hurt to lose that money without any reason :BangHead: .

beware of this ad network!
 

pluton

Active Member
Licensed User
Longtime User
I'm on Leadbolt since May, 2012 and they never ask me to send scanned identity.

From now I recive all money without problem.
Did you clicking your own ads?
What kind of ads you was having? (I think this question is spelled incorectly but English is not my language)
Did you put your app on Google market or somewhere else?
 

capisx

Member
Licensed User
Longtime User
Hi Pluton,
I hope you never experience what happened to me.
I never clicked my own ads or do any fraud thing (if i do, why must wasting time for 10 month to have $100).
I use rich media unlocker and notification ads.
I put my apps on Google Play, SlideMe, GetJar, Mobango, and several forum.

Just beware with this ads network, do not be tempted by the huge income they offer.
 

uswin4224

Member
Licensed User
Longtime User

Yep, 100% same as mine. I use the same document identity that they ask the first time I join this ad network 3 weeks ago. And my case is also the same as capisx , I run push notif ads, I distribute my LWP in market alternative such as mobango, getjar, slideme, etc.., and the first day set my app to active mode, they just banned like that.

Surely leadbolt is not good in my opinion, at least not in my case. just be careful on from this network.

While airpush, it seem I'm having a great support from them, they even help me verify my tax information. Good support.

As for click fraud, as long as I know, I only click this when it is in test mode to see if it working, no way I'm going to sacrifice my account just for a mere click by myself during active mode.

Maybe they should fix this click fraud detection mechanism more carefully, so that DEV who really did distribute their app in a lot of market doesn't get this issue just because of some stupid click fraud algorithm detection.

Just good luck leadbolt.
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…