Android Question [Solved] Problem with Admob-Height

D

Deleted member 103

Guest
Hi,

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)

Correct presentation at HTC-one.


Wrong presentation on Nokia 7.1

 

asales

Expert
Licensed User
Longtime User
Did you have the same behavior using AdView.SIZE_BANNER instead of SMART_BANNER?
 
Upvote 0

LucaMs

Expert
Licensed User
Longtime User
I searched the screen sizes:

Nokia 7.1 - 5.84"

HTC One - 4.7"

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.
 
Upvote 0
D

Deleted member 103

Guest
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

Samsung A5(2017):
AddViewHeight=150

Nokia 7.1:
AddViewHeight=131

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
 
Upvote 0
D

Deleted member 103

Guest
1920 / 2280 = 0.8421

131 / 150 = 0.8733

the difference is insignificant, the two banners have the same height, I think.
Check the top bottom position.

Ciao Mario,

I've already tried that, read my first post.
It has nothing to do with the position.
So that it is correctly displayed correctly on the Nokia, I have to change the height to 90dip, is this normal?
 
Upvote 0

LucaMs

Expert
Licensed User
Longtime User
So that it is correctly displayed correctly on the Nokia, I have to change the height to 90dip, is this normal?
Both displays are less than 6", so...
If GetDeviceLayoutValues.ApproximateScreenSize < 6 Then
'phones
If 100%x > 100%y Then height = 32dip Else height = 50dip
so to get the same height you should change the height to 50dip rather than 90dip. Anyway, I still think they have the same height, 50dip
 
Upvote 0
D

Deleted member 103

Guest
Anyway, I still think they have the same height, 50dip
Should have the same height, but is not so. You can see it in this issue.
 
Upvote 0
D

Deleted member 103

Guest
Upvote 0

sorex

Expert
Licensed User
Longtime User
that's the negative part of banners that they always consume space unless you hide and show them at certain points (game over screen in a game)
 
Upvote 0
D

Deleted member 103

Guest
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?
 
Upvote 0
D

Deleted member 103

Guest
https://www.b4x.com/android/forum/threads/layout-with-banner.86641/

Poi magari nel forum italiano ci dici quale sia il gioco... spero non il mio
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
Si tratta del mio unico gioco di carte Solitario.
This is my only Solitaire card game.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…