B4A Library Leadbolt Ads

Discussion in 'Additional libraries, classes and official updates' started by ssg, Oct 14, 2011.

  1. ssg

    ssg Well-Known Member Licensed User

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

    Code:
    Sub Globals

       
    Dim wv As WebView
       
    End Sub

    Sub Activity_Create(FirstTime As Boolean)
       wv.Initialize(
    "wv")
       
    Activity.AddView(wv, 00100%x50dip)
       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 StringAs 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.
     
    hugh likes this.
  2. Stulish

    Stulish Active Member Licensed User

    Still no change,

    I will give it a better look at tomorrow

    Thanks

    Stu
     
  3. Monkeh

    Monkeh Member Licensed User

    This seems to work OK (so far) for me. Will update if I encounter any problems. Thanks!
     
  4. jalle007

    jalle007 Active Member Licensed User

    here is the code:
    and this is the error
    is it true that leadbolt doesnt work on lower API's (7,8,...) ???

    I would appreciate your help :sign0104:
     
    Last edited: Mar 2, 2013
  5. geewiztech

    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)
     
  6. Erel

    Erel Administrator Staff Member Licensed User

    Where are the instructions related to the manifest file?
     
  7. geewiztech

    geewiztech Member Licensed User

    I've sorted it thanks
     
  8. enrico

    enrico Active Member Licensed User

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

    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: Apr 26, 2014
  10. GMan

    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:
     
  11. aeropic

    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
    Code:
    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)
    Code:
    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 ?
     
  12. GMan

    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 ?

    Code:
    ' 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: May 12, 2014
  13. aeropic

    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 ?
     
  14. GMan

    GMan Well-Known 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:
     
  15. aeropic

    aeropic Active Member Licensed User

    Gman, you're a genious !
    with the stubs subs it's working on the real device but not on the emulator (who cares ? ;))
     
  16. GMan

    GMan Well-Known Member Licensed User

  17. aeropic

    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: May 13, 2014
  18. GMan

    GMan Well-Known Member Licensed User

    Yo, look again ;)
     
  19. ilan

    ilan Expert Licensed User

    gMAN, where can i download the latest lib of Leadbolt??
     
  20. GMan

    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
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice