Android Question Admob for Adwords in B4A App

Simon Smith

Active Member
Licensed User
Hello group,

I have implemented the sample code, added my publisher ID, yet no banner shows. Does it only work when it is signed or something?


Sub Ad
Msgbox ("Ad","s")
End Sub

Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
'Activity.LoadLayout("Layout1")
adview1.Initialize2("Ad", "pub-XXXXXXXXXXXXXX", adview1.SIZE_SMART_BANNER)
Dim height As Int
If GetDeviceLayoutValues.ApproximateScreenSize < 6 Then
'phones
If 100%x > 100%y Then height = 32dip Else height = 50dip
Else
'tablets
height = 90dip
End If
Activity.AddView(adview1, 0dip, 100%y - height, 100%x, height)
End Sub
 

walterf25

Expert
Licensed User
Hello group,

I have implemented the sample code, added my publisher ID, yet no banner shows. Does it only work when it is signed or something?


Sub Ad
Msgbox ("Ad","s")
End Sub

Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
'Activity.LoadLayout("Layout1")
adview1.Initialize2("Ad", "pub-XXXXXXXXXXXXXX", adview1.SIZE_SMART_BANNER)
Dim height As Int
If GetDeviceLayoutValues.ApproximateScreenSize < 6 Then
'phones
If 100%x > 100%y Then height = 32dip Else height = 50dip
Else
'tablets
height = 90dip
End If
Activity.AddView(adview1, 0dip, 100%y - height, 100%x, height)
End Sub
Normally it takes a few hours before you start seeing any live ads if you just signed up with them. Do you have the _OnLoad events and the _OnError events, if not you should add them to see if there's any errors.

Hope this helps.
Walter
 

Simon Smith

Active Member
Licensed User
Hi still no luck.

I thought it might be the webview on top so I took it out and write straight to the Layout1
It should go to the bottom.
I've had Adsense for 5 or so years
It works with my details. Do I need to take out the pub-
Has anyone got the small banner working? Do you have to resize your layout to be smaller?


Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
Activity.LoadLayout("Layout1")
adview1.Initialize2("Ad", "pub-XXXXXXXXXXXXX", adview1.SIZE_SMART_BANNER)
Dim height As Int
If GetDeviceLayoutValues.ApproximateScreenSize < 6 Then
'phones
If 100%x > 100%y Then height = 32dip Else height = 50dip
Else
'tablets
height = 90dip
End If
Activity.AddView(adview1, 0dip, 100%y - height, 100%x, height)
' WebView1.SetLayout(0,0,Activity.width,Activity.height)
End Sub

Sub Activity_OnError
'This is breakpointed

End Sub

Sub Activity_OnLoad
'This is breakpointed

End Sub
 
Top