Skip to content

Add AdMob_Banner_Get_Y(); to Handle Device Notches/Safe Areas #96

Description

@ChopperKhan

Describe the current problem and the solution you would like

When displaying banner ads at the top of the screen on modern devices with notches (iPhone X+, Android devices with camera cutouts), AdMob correctly positions ads below the safe area. However, we have no way to query this position to align UI elements accordingly.

Proposed Function:
AdMob_Banner_Get_Y();
Returns the Y coordinate (in pixels) of the top edge of the banner ad relative to the screen, this will help position game UI elements relative to ads on devices with notches and safe areas.

Example Scenario:
I have a game played in portrait mode with banner ads at the top. I need to position a UI bar directly below the ad. On devices with notches:

AdMob positions the banner below the notch (e.g., at Y = 44px)
My UI elements draw from Y = 0, appearing behind the notch
I can't accurately position UI without knowing where AdMob actually placed the ad

Current Workaround:
My current workaround is to estimate safe area insets based on aspect ratios or hardcode values, which is unreliable across different devices.

Technical Implementation:
Both native SDKs provide this information:
iOS: bannerView.frame.origin.y
Android: adView.getY() or adView.getTop()

By getting the ad positions we can properly position UI elements relative to ads on all devices, providing a better user experience without hacky workarounds.

Describe any alternative solutions

No response

Metadata

Metadata

Assignees

Labels

AdmobThis issue affects the specific named extensiondocumentationThis issue also requires changes to be made to the extension's documentationextensionThis issue is to do with any of the official extensions

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions