this code does not work properly on my Nokia 7.1, because the banner is cut off (see pictures).
So that it is correctly displayed correctly on the Nokia, I have to change the height to 90dip, is this normal?
B4X:
Adview1.Initialize2("Ad", "xxxxxxxx", 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 - (toolbar.height + height), 100%x, height)
1) so the banner height seems wrong on the HTC
1) log(GetDeviceLayoutValues.ApproximateScreenSize) 3) the position of the banner seems wrong to me; it appears to be positioned lower down.
Here's the output of this routine on Samsung A5(2017) and Nokia 7.1.
B4X:
Sub GetAddViewHeight As Int
Dim height As Int
If GetDeviceLayoutValues.ApproximateScreenSize < 6 Then
'phones
If 100%x > 100%y Then height = 32dip Else height = 50dip
Else
If 100%y > 100%x Then
'tablets
height = 90dip
Else
height = 50dip
End If
End If
Log("AddViewHeight=" & height)
Return height
End Sub
For Nokia, the Adview height should be higher than the Samsung, because the display height of the Nokia is higher than that of the Samsung.
Nokia-Diplay: 1.080 x 2.280 Pixel
Samsung-Display: 1.080 x 1.920 Pixel
Should have the same height, but is not so. You can see it in this issue.
Code:
Sub GetAddViewHeight As Int
Dim height As Int
If GetDeviceLayoutValues.ApproximateScreenSize < 6 Then
'phones
If 100%x > 100%y Then height = 32dip Else height = 50dip
Else
If 100%y > 100%x Then
'tablets
height = 90dip
Else
height = 50dip
End If
End If
Log("AddViewHeight=" & height)
Return height
End Sub
Samsung A5(2017):
AddViewHeight=150
Nokia 7.1:
AddViewHeight=131
If I strictly follow the Google guidelines, then I have no suitable place for a banner.
This app with this banner I have been in Play-Store for years, the last update I made in March 2019.
Let's see if anything comes.
Hi,
I have to open this post again, because the problem is not resolved yet.
In this photo are 2 smartphones where you can see that the height of the banner is right and the other is not.
How can you solve the problem?
unfortunately this does not solve my problem.
I noticed though that in Nokia you have to enlarge the banner to 90dip to be corrected.
But this cannot be the solution.
Poi magari nel forum italiano ci dici quale sia il gioco... spero non il mio
It works well for me. I use a panel as base, set its top and height based on the height of the banner (which depends on the device) and then load the layout into this base panel.