Android Question Activities & AdMob

Discussion in 'Android Questions' started by fishwolf, Feb 13, 2015.

  1. fishwolf

    fishwolf Active Member Licensed User

    I have a B4A (and B4I) application with a main activity with 5 buttons, when select a button open a activity for each button.
    Each activity have a AdMob banner.
    All work fine.
    The problem is that the banner is loaded again for each activity, it's showed many times, but for a bit of time.
    The result is many impression, but a bit of money.

    as I avoid this problem?
     
  2. fishwolf

    fishwolf Active Member Licensed User

    The question is:

    can i create a fragment effect?
    or
    can i create a AdMob banner to main activity and show the same banner into sub-activities?
     
    Last edited: Feb 14, 2015
  3. Erel

    Erel Administrator Staff Member Licensed User

    You can remove the AdView from the first activity and then call CallSubDelayed2 to start the second activity and pass the AdView as a parameter.
     
  4. fishwolf

    fishwolf Active Member Licensed User

    i have done in this mode, now the second activity don't receive a new banner, but into secondo activity the banner is not received again (no Ad_ReceiveAd event).

    Main activity
    Code:
    Sub Globals
      
    Dim AdView1 As AdView
    End Sub

    Sub Activity_Create(FirstTime As Boolean)

      
    Activity.LoadLayout("Main")

      AdView1.Initialize(
    "Ad""xxxxxxxxxxxxxxxxxxxxx/yyyyyyyyyy")  
      
    Activity.AddView(AdView1, 0dip0dip320dip50dip)
      AdView1.LoadAd 
    'loads an ad
      AdView1.Background = Null
        
    End Sub

    Sub ButtonShow_Click
      
       AdView1.RemoveView
       
    StartActivity(Show)
       CallSubDelayed2(Show,
    "SetAdView",AdView1)
      
    End Sub
    Show Activity
    Code:
    Sub Globals
       
    Dim AdView1 As AdView
    End Sub

    Sub SetAdView (Banner As AdView)
       AdView1 = Banner
       
    Activity.AddView(AdView1, 0dip0dip320dip50dip)
    End Sub

    Sub Activity_Create(FirstTime As Boolean)

       
    Activity.LoadLayout("Show")

    End Sub
     
  5. Erel

    Erel Administrator Staff Member Licensed User

    The event will not work with this solution. I think that your best option is to create an AdView for each Activity. This is how Android works.
     
  6. fishwolf

    fishwolf Active Member Licensed User

    i already done in this mode.
    to your experience, it's best for money

    1) 3 banner for 10 seconds
    or
    2) 1 banner for 30 seconds

    if the timer banner is 30 seconds.
     
  7. Erel

    Erel Administrator Staff Member Licensed User

    Sorry but I don't have any real experience with AdMob.
     
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