.
Last edited:
Sub Globals
Dim pnlAD As Panel
Dim AdBar As AdView
Dim AD_SIZE As Object
Dim adWidth As Int
Dim adHeight As Int
End Sub
Sub AdBarInit
' set the AD Bar, choose the right size
If pnlAD.Width < 468dip Then
' normal
AD_SIZE = AdBar.SIZE_BANNER
adWidth = 320dip
adHeight = 50dip
Else If pnlAD.Width < 728dip Then
' large
AD_SIZE = AdBar.SIZE_IAB_BANNER
adWidth = 468dip
adHeight = 60dip
Else
' tablet
AD_SIZE = AdBar.SIZE_IAB_LEADERBOARD
adWidth = 728dip
adHeight = 90dip
End If
' add the AD bar on the panel
AdBar.Initialize2("Ad", "xxxxxxxxxxxxxxxx", AD_SIZE)
pnlAD.AddView(AdBar, 50%x-(adWidth/2), 0, adWidth, adHeight)
'AdBar.LoadAd
Log("AD initialized")
End Sub
Be very careful when you choose large Admob units. Google's TOS specifically states that phones should use 320x50 only and not the bigger or wider units. Units 300x250, 468x60 and 728x90 are to be used on tablets only. I asked Google support and they confirmed it.
And you can't differentiate tablets and phones with resolution alone. A common tablet resolution is 1280x800 but Samsung Galaxy Note which is a 5.3" phone also uses that. You should use 320x50 on Galaxy Note while any of the other units on devices that have 7" or bigger display, which is how tablets are normally defined.
So I would say, consider the physical size of the device as well, when selecting the right ad unit. Sure, a 320x50 looks bad on Galaxy Note, Galaxy Nexus and all the top-end 1280x720 phones but unfortunately if you use a bigger unit, Google might suspend the account.
It's stil at 75% width on my 7" tablet and looks fine on my samsing galaxy s phone. 75% is fine with me, but I'm just curious.
50%x-(adWidth/2)