iPhoneX admob ad offset?

I have a game in the stores and got some feedback with new iPhones where players have this problem:

admob ads seem to have an offset (about 50px from the device border) and blocking the view on some GUI elements in the game.

Is this a known issue?

I first thought it is something in my code but can’t find something wrong (until now). Will continue looking into it but have to ask if this is something happening elsewhere right now?

Thanks for your help!

Show us the code (from your game) where you display the banner, so we can help.

i.e. How exactly are you calling admob.show() (https://docs.coronalabs.com/plugin/admob/show.html) ?

The AdMob ad plugin already understands safe zone offsets. You don’t need to do anything extra, however, your app has to also understand safe zone offsets and position UI elements properly.

In addition to what @roaminggamer is asking, can you also post a screenshot? But as I’m typing that question, I realized you might not have an iPhone X to test with. You should be able to test on the Xcode Simulator while simulating an iPhone X. You can also put up your app up on test flight and ask for iPhone X owners to test for you. Now that there are three new iPhone X models out and people are upgrading you should be able to find more people who can help you test.

Rob

Thank you for your fast reply and help! I do nothing special in the code and call the admob banner without any extra positions.

It reads like it is admob detecting the device and a safe area to show the ad while the app is not because it is not looking for the next generation of Apple devices. So I think I have to test it like Rob is saying.

Are there any infos on how big the offset of the banner is? Can I look into the value via code?

Is it possible to turn the admob auto offset off somehow and do things manually?

Thanks for your help!

We have API’s in the display.* family that gets you the proper safe zone offsets.  See:

http://docs.coronalabs.com/api/library/display/safeActualContentWidth.html

http://docs.coronalabs.com/api/library/display/safeActualContentHeight.html

http://docs.coronalabs.com/api/library/display/safeScreenOriginX.html

http://docs.coronalabs.com/api/library/display/safeScreenOriginY.html

http://docs.coronalabs.com/api/library/display/getSafeAreaInsets.html

You can do something like:

local safeBottom = display.safeActualContentHeight + display.safeScreenOriginY local bannerHeight = 50 -- advertising buerau standard mobile banner height on phones tabBar.y = safeBottom - bannerHeight - tabBar.height / 2

untested of course.

Finally, the AdMob’s .show() method lets you set a “y” value that either can be something simple like “top” or “bottom” or a number to positioning anywhere on the screen.

Rob

Thank you very much for the details and help!

One more question: How can I test admob on the iPhoneX simulator (Xcode)? I currently got a runtime error, because this doesn’t seem to work with the plugin in the emulator.

Can you post your build.settings?

I now have a device to test, so no need for the simulator anymore.

But I have one more question regarding the safe zone offsets: How do I check when to use them?

It looks like they also are used on older iPhones which don’t need the offset for example. So how do I check if a device is needing a safe zone?

https://docs.coronalabs.com/api/library/display/getSafeAreaInsets.html

I then have to look into it a little bit more. I had offsets (in the simulator) for an iPhone5… but there shouldn’t be any, right?

If you are on a device that doesn’t have any notch like features, display.safeActualContentHeight and display.actualyContentHeight should be the same. 

Also, display.safeScreenOriginY and display.screenOriginY should be the same (as well as the Width and X variants of the API calls).

Where there may be a difference, I believe that the “safe” calls take status bars into consideration and you shouldn’t be positioning UI elements under status bars anyway, so using the “safe” calls should work just fine on the iPhone 5, 6, 7 and 8 families.

Rob

Show us the code (from your game) where you display the banner, so we can help.

i.e. How exactly are you calling admob.show() (https://docs.coronalabs.com/plugin/admob/show.html) ?

The AdMob ad plugin already understands safe zone offsets. You don’t need to do anything extra, however, your app has to also understand safe zone offsets and position UI elements properly.

In addition to what @roaminggamer is asking, can you also post a screenshot? But as I’m typing that question, I realized you might not have an iPhone X to test with. You should be able to test on the Xcode Simulator while simulating an iPhone X. You can also put up your app up on test flight and ask for iPhone X owners to test for you. Now that there are three new iPhone X models out and people are upgrading you should be able to find more people who can help you test.

Rob

Thank you for your fast reply and help! I do nothing special in the code and call the admob banner without any extra positions.

It reads like it is admob detecting the device and a safe area to show the ad while the app is not because it is not looking for the next generation of Apple devices. So I think I have to test it like Rob is saying.

Are there any infos on how big the offset of the banner is? Can I look into the value via code?

Is it possible to turn the admob auto offset off somehow and do things manually?

Thanks for your help!

We have API’s in the display.* family that gets you the proper safe zone offsets.  See:

http://docs.coronalabs.com/api/library/display/safeActualContentWidth.html

http://docs.coronalabs.com/api/library/display/safeActualContentHeight.html

http://docs.coronalabs.com/api/library/display/safeScreenOriginX.html

http://docs.coronalabs.com/api/library/display/safeScreenOriginY.html

http://docs.coronalabs.com/api/library/display/getSafeAreaInsets.html

You can do something like:

local safeBottom = display.safeActualContentHeight + display.safeScreenOriginY local bannerHeight = 50 -- advertising buerau standard mobile banner height on phones tabBar.y = safeBottom - bannerHeight - tabBar.height / 2

untested of course.

Finally, the AdMob’s .show() method lets you set a “y” value that either can be something simple like “top” or “bottom” or a number to positioning anywhere on the screen.

Rob

Thank you very much for the details and help!

One more question: How can I test admob on the iPhoneX simulator (Xcode)? I currently got a runtime error, because this doesn’t seem to work with the plugin in the emulator.

Can you post your build.settings?

I now have a device to test, so no need for the simulator anymore.

But I have one more question regarding the safe zone offsets: How do I check when to use them?

It looks like they also are used on older iPhones which don’t need the offset for example. So how do I check if a device is needing a safe zone?

https://docs.coronalabs.com/api/library/display/getSafeAreaInsets.html

I then have to look into it a little bit more. I had offsets (in the simulator) for an iPhone5… but there shouldn’t be any, right?