B4A Library Leadbolt Ads

ssg

Well-Known Member
Licensed User
Just wrote this one for testing, replace with your own section id:

B4X:
Sub Globals

   Dim wv As WebView
   
End Sub

Sub Activity_Create(FirstTime As Boolean)
   wv.Initialize("wv")
   Activity.AddView(wv, 0, 0, 100%x, 50dip)
   wv.JavaScriptEnabled = True
   wv.LoadHtml("<body marginwidth='0' marginheight='0' leftmargin='0' topmargin='0'> <script Type='text/javascript' src='http://ad.leadboltads.net/show_app_ad.js?section_id=xxxxxxxx'></script>")

End Sub

Sub wv_OverrideUrl (Url As String) As Boolean
   Dim i As Intent
    i.Initialize(i.ACTION_VIEW, Url)
    StartActivity(i)
   wv.LoadHtml("<body marginwidth='0' marginheight='0' leftmargin='0' topmargin='0'> <script Type='text/javascript' src='http://ad.leadboltads.net/show_app_ad.js?section_id=xxxxxxxx'></script>")
    Return True
End Sub
It works fine on my device, with a neat little trick of loading a new ad once the user clicks on the current one :D

Give that a try.
 

Monkeh

Member
Licensed User
Just wrote this one for testing, replace with your own section id:

B4X:
Sub Globals

   Dim wv As WebView
   
End Sub

Sub Activity_Create(FirstTime As Boolean)
   wv.Initialize("wv")
   Activity.AddView(wv, 0, 0, 100%x, 50dip)
   wv.JavaScriptEnabled = True
   wv.LoadHtml("<body marginwidth='0' marginheight='0' leftmargin='0' topmargin='0'> <script Type='text/javascript' src='http://ad.leadboltads.net/show_app_ad.js?section_id=xxxxxxxx'></script>")

End Sub

Sub wv_OverrideUrl (Url As String) As Boolean
   Dim i As Intent
    i.Initialize(i.ACTION_VIEW, Url)
    StartActivity(i)
   wv.LoadHtml("<body marginwidth='0' marginheight='0' leftmargin='0' topmargin='0'> <script Type='text/javascript' src='http://ad.leadboltads.net/show_app_ad.js?section_id=xxxxxxxx'></script>")
    Return True
End Sub
It works fine on my device, with a neat little trick of loading a new ad once the user clicks on the current one :D

Give that a try.
This seems to work OK (so far) for me. Will update if I encounter any problems. Thanks!
 

jalle007

Active Member
Licensed User
here is the code:
iLeadbolt.Initialize("LeadboltI")
iLeadbolt.setListener()
iLeadbolt.loadLeadboltAds("xxxxxxx",iLeadbolt.ADS_DISPLAY)

xLeadbolt.Initialize("LeadboltX")
xLeadbolt.setListener()
xLeadbolt.loadLeadboltAds("xxxxxxx", xLeadbolt.ADS_NOTIFICATION)
and this is the error
xLeadbolt.loadLeadboltAds("330888281", xLeadbolt.ADS_NOTIFICATION)
java.lang.NoSuchMethodError: com.pad.android.util.AdOptinRequest.<init>
is it true that leadbolt doesnt work on lower API's (7,8,...) ???

I would appreciate your help :sign0104:
 
Last edited:

geewiztech

Member
Licensed User
Can you give me an example of what to put in the manifest editor (I don't want to write directly to the manifest)
 

enrico

Active Member
Licensed User
Just wrote this one for testing, replace with your own section id:

B4X:
Sub Globals

   Dim wv As WebView
  
End Sub

Sub Activity_Create(FirstTime As Boolean)
   wv.Initialize("wv")
   Activity.AddView(wv, 0, 0, 100%x, 50dip)
   wv.JavaScriptEnabled = True
   wv.LoadHtml("<body marginwidth='0' marginheight='0' leftmargin='0' topmargin='0'> <script Type='text/javascript' src='http://ad.leadboltads.net/show_app_ad.js?section_id=xxxxxxxx'></script>")

End Sub

Sub wv_OverrideUrl (Url As String) As Boolean
   Dim i As Intent
    i.Initialize(i.ACTION_VIEW, Url)
    StartActivity(i)
   wv.LoadHtml("<body marginwidth='0' marginheight='0' leftmargin='0' topmargin='0'> <script Type='text/javascript' src='http://ad.leadboltads.net/show_app_ad.js?section_id=xxxxxxxx'></script>")
    Return True
End Sub
It works fine on my device, with a neat little trick of loading a new ad once the user clicks on the current one :D

Give that a try.
It works but opens the Webview in the same banner window.
Is it possible to open in full size in a new window ?
 

GMan

Well-Known Member
Licensed User
So, got it to work (i think).
Will be back with some more results (App still in Approvement)
 
Last edited:

GMan

Well-Known Member
Licensed User
Roger :D
All works fine - it took some time to get all all improvements and possibilities are "saved to BrainDisk" :oops:
An all in one TUTs for all those Libs are appreciated :rolleyes:
 

aeropic

Active Member
Licensed User
Hi,

I just try to add some leadbolt ad in my apps... Up to now without success !
What I did;
- created an account on leadbolt
- generated an app banner ad and coolected the "serial number"
- generated a SDK for B4A
- installed all files (pmfogauiuitu.xml & jar + LeadBoltB4A.xml & jar) into the libs directory
- added those libs to the application
- added
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.INTERNET"/>
in the manifest
B4X:
AddManifestText(
<uses-sdk android:minSdkVersion="4" />
<supports-screens android:largeScreens="true"
    android:normalScreens="true"
    android:smallScreens="true"
    android:anyDensity="true"/>
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
    <uses-permission android:name="android.permission.INTERNET"/>)
and coded this (based on circleseek example)
B4X:
Sub Globals
    Dim vbar As VSeekbar
    Dim Hbar As HSeekbar
    Dim cs, cs2 As CircleSeek
   
    Dim ad As LeadBoltB4A
End Sub

Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("bar.bal")
Hbar.setColors(Colors.Black, Colors.white, Colors.rgb(255,180,180), Colors.white)
vbar.setColors(Colors.Black, Colors.yellow, Colors.rgb(150,150,255), Colors.white)
'Size.SetSize(Activity,480,320)

              '  Code creation
cs2.Initialize(Me,"cs2")
cs2.CodeCreateView(31%x,31%x,100, cs2.SHORT_KNOB)
Activity.AddView(cs2.AsView,20%x,60%y,40%x,40%x)
                ' set the colors and text size
cs.setColors(Colors.RGB(150,150,255), Colors.blue, Colors.RGB(180,180,255), Colors.Yellow, 12*Size.cf)
'cs2.setColors(Colors.RGB(150,150,255), Colors.blue, Colors.RGB(180,180,255), Colors.Yellow, 24*Size.cf)
' cs2 will have the default colors


'for all ad types
    ad.Initialize("540410629")

    'To run LeadBolt Display Ad
    ad.loadAd()
End Sub
it compiles fine, runs well but no ad is shown neither on the AVD nor on the phone.

Am I missing something to allow the ad to be displayed ? Adding a view somewhere ?
 

GMan

Well-Known Member
Licensed User
Is the App still in Approval Mode or Test Mode ?
If first, you have to wait until its approved, if second you have to set it to Active Mode.

When not approved yet, you can start a test with that section id.

Normally it leasts only some minutes (after placing the section id ifrom an approved app) until the Ads from leadbolt are displayed

Initializing is enough, when you call ad.LoadAd all other is done automatically

Did you insert the Subs for LeadBolt ?

B4X:
' Leadbolt ->
Sub Leadbolt_AdClicked

End Sub
Sub Leadbolt_AdClosed

End Sub
Sub Leadbolt_AdCompleted

End Sub
Sub Leadbolt_AdFailed

End Sub
Sub Leadbolt_AdLoaded

End Sub
Sub Leadbolt_AdCached

    'If ad.loadAdToCache() used, add the following line here -> ad.loadAd()

End Sub
Sub Leadbolt_AdProgress

End Sub
Sub Leadbolt_AdAlreadyCompleted

End Sub
Sub Leadbolt_AdPaused

End Sub
Sub Leadbolt_AdResumed

End Sub
'Event Listeners for Audio Ads
Sub Leadbolt_AudioAdProgress

End Sub
Sub Leadbolt_AudioAdClicked

End Sub
Sub Leadbolt_AudioAdClosed

End Sub
Sub Leadbolt_AudioAdFinished

End Sub
Sub Leadbolt_AudioAdFailed

End Sub
Sub Leadbolt_AudioAdLoaded

End Sub
Sub Leadbolt_AudioAdCached

    'If ad.loadAudioAdToCache() used, add the following line here -> ad.loadAudioAd()

End Sub
' Leadbolt <-
 
Last edited:

aeropic

Active Member
Licensed User
thanks Gman,

App is in test mode and this is why I tested it in the emulator. It should work shouldn't it ?

I did not insert any sub from LeadBolt... Could it be the reason ?
 

GMan

Well-Known Member
Licensed User
App is in test mode and this is why I tested it in the emulator. It should work shouldn't it ?
Yo ;-) But i never tested in on the Emulator, on a real device the test mode works
I did not insert any sub from LeadBolt... Could it be the reason ?
Maybe - they are all empty, but...paste them, didn't take much space :cool:
 

aeropic

Active Member
Licensed User
Yo ;-) But i never tested in on the Emulator, on a real device the test mode works

Maybe - they are all empty, but...paste them, didn't take much space :cool:
Gman, you're a genious !
with the stubs subs it's working on the real device but not on the emulator (who cares ? ;))
 

aeropic

Active Member
Licensed User
I had a look...thank for the advice.
I did not even add the full internet access because the admob banner I have too in that application does the job, but you're right all extra authorization have been added automatically by leadbolt librairy in the manifest.
==> I wonder if Leadbolt is the right choice !
 
Last edited:

GMan

Well-Known Member
Licensed User
You have to create it for your personal use...Download SDK -> then it is generated online specially for you - then you can downoad it
 
Top