kloder-games / godot-admob

Module Admob for Godot engine
MIT License
360 stars 61 forks source link

Admob.getBannerHeight() returns wrong value #129

Closed Tobi-La closed 4 years ago

Tobi-La commented 4 years ago

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

Tobi-La commented 4 years ago

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?

Tobi-La commented 4 years ago

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

Tobi-La commented 4 years ago

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;
}
gumaciel commented 4 years ago

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

gumaciel commented 4 years ago

closed at #132 @Shin-NiL