Getting the correct height of adaptive banner

381 views
Skip to first unread message

jo...@fm-games.com

unread,
Nov 18, 2021, 5:29:20 AM11/18/21
to Google Mobile Ads SDK Developers
Hello, I am facing a weird bug(?) in my app (using Gooble mobile ads Unity plugin ver 6.0.0)  where I am using anchored adaptive banners as per the documentation here:
https://developers.google.com/admob/unity/banner/anchored-adaptive

So from what I see in the SDK there is a function to get the size of the banner view in pixels(which calls in return a native android function to return the size of the view in pixels). The weird thing that's happening is that the height I am getting returned is not always correct. Moreover I have noticed situations where I will get 2 ads of the same size(by putting 2 same devices side by side) and one will return a different height than the other. 

I also did a check just to be sure by taking a printscreen, checking the log of the height of the banner and comparing it with the percentage of the whole screen how many pixels it should be and it was about ~50 pixels bigger. 

My question would be, is the height of the bannerview a "correct" solution to be used in general to place UI?(The UI on my app is dependant on moving elements depending with the ad height for example). For now I have fixed it by setting a specific dp ad height for the banners(90 for tablet and 50 for phones) and turning that into pixels for each device and moving the UI accordingly. But shouldn't the bannerview return me the correct height? Is it because it's an adaptive banner? Is it considered good practise to use the banner height of the bannerview to layout my app's UI? Thank you in advance.

Mobile Ads SDK Forum Advisor

unread,
Nov 18, 2021, 5:19:02 PM11/18/21
to jo...@fm-games.com, google-adm...@googlegroups.com
Hi Jo,

Thank you for bringing this concern to our attention.We would start by asking if you can share with us via the “Reply to author” button. With a simple sample app, along with the steps to replicate this issue. At the same time if you can include any stack traces or Charles logs to help in our investigation. This would be greatly appreciated.

Regards,

Google Logo
William Pescherine
Mobile Ads SDK Team
 


ref:_00D1U1174p._5004Q2RA7Jv:ref
Reply all
Reply to author
Forward
0 new messages