r/gamemaker • • 4d ago

Help! How to account for Android camera notch when using Admob banner?

I'm working on a free-with-ads Android port of one my games, and I've reached the point where I am adding the ads. Gamemaker's Admob extension has been handy, but I'm having an issue with adjusting the top of the game screen while displaying a banner ad at the top of the screen.

When I display a banner, its position is affected by whether the phone has a "notch" where the camera sits. The area at the top of the phone is considered a "safe" area where the ad won't display, so the banner appears lower down the screen when a notch is present.

What I want to do is display the banner, get the height of the banner, then move the game down by that much so the top of the screen isn't cut off. However, I can't see any way to tell if the banner shows up lower than normal. In those cases, I need to move the game area down by height_of_banner + height_of_safe_area, but I haven't been able to find any way that GMS2 can retrieve any information about the safe area.

If there really isn't a way, I suppose I can just remove the banner and rely on interstitial ads, but I'd appreciate any information or leads anyone could provide!

1 Upvotes

2 comments sorted by

1

u/Agile_Lake3973 3d ago

My quick fix was to just move the ad to the bottom of the screen.

1

u/ZAD-Man 3d ago

I considered that, but I have a keyboard being used on the bottom of the screen, and I think it would lead to too many misclicks... I appreciate the response though 🙂