Search code examples
androidapache-flexadmobane

Admob Milkman Games ANE placement within Flex View Android


I'm trying to get a handle on how to place an admob ad at either the top or bottom of a flex mobile app view using the Milkman Games externsion in Android.

So Essentially if I elect to do the following within my View

AdMob.showAd(AdMobAdType.BANNER, AdMobAlignment.CENTER, AdMobAlignment.BOTTOM);

How do I make room for the ad within the view at the bottom?

At this stage the view has a scroller component and I want the ad to sit at the bottom of the screen all the time.

Do I use the inbuilt ANE function:

 AdMobAdType.getPixelSize(AdMobAdType.BANNER)

to determine the height of the ad that is served, and then adjust the constraint for the bottom of my scroller to stop short of the ad?

p.s. Can anyone shed light on whether V3.0.2 is the latest for this Milkman Games Admob extension? I haven't heard back from them about whether it is.


Also I'd add to this on the positioning and sizing side of things... I'm requesting standard banners and then actually manually working out how much height to allow them based on the fact that a "standard" banner is 320x50 dp units. That's assuming the device is in a 160dpi category from there you use a formula to work out how many pixels it will take on a 240 or 320 dpi device.

You could alternatively just use the milkman AdMobAdType.getPixelSize function to get the actual display size. When I have my actual height size I just add a touch of padding to that to keep the app content a little bit further away from the ad. As my flex ap has mainly scrollers inside Views I set the "bottom" property of my scroller to be my ad container size. This allows the ad to sit at the bottom of the mobile view nicely. You could use the "top" property on the scroller just the same.

Cheers Marco


Solution

  • Yes, that's exactly the approach to use. You could also use a hard-coded estimate (e.g. 50 px) as your default bottom constraint on your scroller; that will lessen the visual impact of resizing your container once the ad loads.