Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AdMob Banner Sizes on Android

Tags:

android

admob

I am currently integrating AdMob into my Android game.

I have difficulties integrating smart banners into my framelayout-based layout, because they take up different amounts of screen real estate on different devices.

For example, if I display a smart banner on my Acer A500 (MDPI 1280x800), I receive one of the size 1280x90px, whereas on my Nexus 7, I receive one with 1279x66px (TVDPI 1280x800) and on my Galaxy Nexus (HDPI 1280x720) with 1196x64px.

According to the AdMob documentation, that might be understandable behaviour, considering that the values given in the documentation are dp: https://developers.google.com/mobile-ads-sdk/docs/admob/smart-banners

However, this behaviour is a great problem for me, since a smartbanner with a height of 90px on a 1200x800px MDPI screen takes up a lot more screen real estate than a smart banner with a height of 64px on an HDPI screen (See screenshots below).

So, here are my questions: - How much space should i reserve at least for a smart banner? - Has anyone tried something similar, and how did you deal with that?

Note: Unfortunately, using a layout different to framelayout is not an option at the moment. Additionally, XML layouts can not be used to integrate the ads.

Best Regards,

Lorenz

Screenshots:

http://imgur.com/qGAk77Y (A500)

like image 292
lorenz Avatar asked Jul 29 '13 12:07

lorenz


1 Answers

If your layout is define in a xml, you can create one layout per screen size (layout-xlarge/mylayout.xml, layout-large/mylayout.xml, layout-normal/mylayout.xml, etc...)

More info here : http://developer.android.com/guide/practices/screens_support.html

Don't look at density, because, a 10.1" tablet has a medium density, but a 4.3" phone with a 480x850 resolution will have a high density. Use screen size instead (xlarge large normal small).

If you need to do it programatically, you can get the screen size with this :

Configuration config = activity.getResources().getConfiguration();
int screenlayout = config.screenLayout;

and to compare, use Configuration.SCREENLAYOUT_xxx .

like image 140
Aakash Jindal Avatar answered Sep 22 '22 00:09

Aakash Jindal