kloder-games/godot-admob

Admob.getBannerHeight() returns wrong value

Tobi-La opened this issue · 5 comments

OS target (Android/iOS):
iOS

Godot version:
3.2 stable

Issue description:
Hey, on my iPhone 6s Admob.getBannerHeight() returns 32. I made a screenshot to measure that and noticed that the displayed ad is 64px high instead.

I need the correct value for ui positioning. Am I overlooking something? Is there a way to reliably get the correct value? Calculating times 2 sounds strange to me, even though it would work in my case.

Thanks,
Tobias

32 is by the way the same size that the test banner states:
ad1

The x2 doesn't seem to work, I found another screenshot from a tester which has a test banner on it that says it's a 60 height banner, but is instead 180 pixels high. So it seems to me that those banners are scaled. Can I somehow determine the scaling?

It seems I found the explanation for issue:
https://groups.google.com/forum/#!msg/google-admob-ads-sdk/YZdVF8kfPU8/UWPUE9MMCAAJ

the scale factor is missing in the source code

Fixed it with using the following code:

- (int) getBannerWidth {
    return bannerView.bounds.size.width * [UIScreen mainScreen].scale;
}

- (int) getBannerHeight {
    return bannerView.bounds.size.height * [UIScreen mainScreen].scale;
}

please create a Pull Request to @Shin-NiL aprove that changes, when i get my Macbook i will test this

closed at #132 @Shin-NiL