AdMob Banner Ad FLAWED Placement

Hello, I noticed an issue with AdMob ad placement whenever I use ‘letterbox scaling’ in my apps.

The following code shows how I instantiate the ad. As you can see, I set the x position to be 0.

ads.show( "banner", { x=0, y=10000000, appId=menuScene.adInfo.appID} )

When there is no letterbox scaling, it works perfectly:

NRTb9Rl.png

HOWEVER, when there is letterbox scaling, Corona SDK fails to make the appropiate adjustments for the ad position. Instead of positioning the ad on the x = 0 of the Corona app, it positions the ad on the x = 0 of the device. This results in an off-putting and ugly layout.

3VZjCRR.png

Does anyone know a workaround around this bug so that I can position the ad correctly, or am I doing something wrong? Thanks in advance.

You probably could grab display.screenOriginX (which will be a negative number), get the absolute value of it and position the ad at that location:

ads.show( “banner”, { x=math.abs(display.screenOriginX), y=10000000, appId=menuScene.adInfo.appID} )

See: http://docs.coronalabs.com/api/library/display/screenOriginX.html

Rob

Your answer is solved it.

However display.screenOriginX returns a positive number so instead of

ads.show( "banner", { x=math.abs(display.screenOriginX), y=10000000, appId=menuScene.adInfo.appID} )

you’ll just need

ads.show( "banner", { x=display.screenOriginX, y=10000000, appId=menuScene.adInfo.appID} )

You probably could grab display.screenOriginX (which will be a negative number), get the absolute value of it and position the ad at that location:

ads.show( “banner”, { x=math.abs(display.screenOriginX), y=10000000, appId=menuScene.adInfo.appID} )

See: http://docs.coronalabs.com/api/library/display/screenOriginX.html

Rob

Your answer is solved it.

However display.screenOriginX returns a positive number so instead of

ads.show( "banner", { x=math.abs(display.screenOriginX), y=10000000, appId=menuScene.adInfo.appID} )

you’ll just need

ads.show( "banner", { x=display.screenOriginX, y=10000000, appId=menuScene.adInfo.appID} )