So, I am embedding admob banners in my Android Unity 4.6 game. I have a banner below and need to consider it in my user interface. In particular, I need to know exactly how tall he is, but I am having problems with this.
Based on the information found here, the Smart Banner should be 32, 50 or 90 pixels in height, depending on the height of the device. This is usually not the case.
Some searches seem to indicate that this is due to pixel density. So I'm trying to convert the specified pixel height using px = dp * (Screen.dpi / 160). So, for example, if I determine that the banner height should be 90 pixels, I would use bannerHeight = 90 * (Screen.dpi / 160). This seems to work on some devices, but not on others.
For example, my Nexus 4 has a DPI 320. Using the above, it looks like the banner should be 180 pixels high, but the banner seems to be about 90 pixels. But on the Nexus 7 (which has an 166 inch), the banner, as you can see, is about 120 pixels when the formula indicates that it should be ~ 93.
So, I don’t know how to understand how high the banner really is, and I did not find a way to get this information from the API. My code for calling the banner is pretty good:
string adUnitId = "my_id";
BannerView bannerView = new BannerView(adUnitId, AdSize.SmartBanner, AdPosition.Bottom);
AdRequest request = new AdRequest.Builder().Build();
bannerView.LoadAd(request);