As I told, I came to know about this 2 days back. Don’t have any first hand confirmation on this. But I think the reason is that, when users see bigger ads (on tv, intetnet or roads also), they tend to click or buy the stuff and hence increased ctr.
Well I use Admob mediation - and last I checked the SMARTBANNER was not available as an option. The banner appears in a constant size (dp-wise) on all devices - so banners are ultra small on tablets.
I am actually not that clear WHAT an Admob SMARTBANNER is - except that from Admob webpage that it is some “smart” as in color or size adjusted or extra space outside the banner is set to some color or what … (?)
If one were to scale the Admob banner ad (delivered via mediationID - if you are using Admob mediation) - then are all the partner banner ads ALSO scaled etc. (?) I guess this could be done and checked for the ad networks one is mediating (or is it that banner ads are somehow specified in some banner-agnostic way or something ?).
no. mediation only has support for 320 x 50. If you want access to other sizes, you need to switch to stand-alone mode. This I verified today only as one of my app was using mediation and when I specified IAB_LEADERBOARD, I got the error that received 320x50 and doesn’t match requested ad size.
Guys this method works amazing. My CTR and hence earnings have shot up 100% in last 15 days. The daily impressions are going same as on 8th December when I made this change. This code is recommended for everyone have java code for banners. For Unity and other softwares, you need to write the code yourself. The revised java code which is different from my first post is:
double density = dm.density * 160;
double x = Math.pow(dm.widthPixels / density, 2);
double y = Math.pow(dm.heightPixels / density, 2);
double screenInches = Math.sqrt(x + y);
if(screenInches > 8 ) {
adsize = AdSize.IAB_LEADERBOARD;
} else if (screenInches > 6) {
adsize = AdSize.IAB_BANNER;
} else {
adsize = AdSize.BANNER;
}
RelativeLayout adContainer = (RelativeLayout) findViewById(R.id.mainLayout);
adView = new AdView(this, adsize, admobunitid);
adView.setAdListener(this);
AdRequest adRequest = new AdRequest();
adView.loadAd(adRequest);
// Place the ad view.
adContainer.addView(adView, 0);
The ad sizes this code displays is:
>8 inches = 728x90
>6 inches = 468x60
<=6 inches = 320x50
Also if the ad cannot fit due to so varied android device sizes, setup and adlistener for executing code when ad cannot fit. Make current class as AdListener and add the following overridden method. Rest of the overridden AdListener methods can be left empty.
@Override
public void onFailedToReceiveAd(Ad arg0, ErrorCode arg1) {
adView = new AdView(this, AdSize.SMART_BANNER, admobunitid);
AdRequest adRequest = new AdRequest();
adView.loadAd(adRequest);
}
May Lord Jesus bless all of us, forgive us of all wrongful deeds (spamming, copying, abusing) that we have done in last year to earn money from android and may He help us live a spotless life with Android Development.
Amen!
Thanks for sharing dude! I’ll definitely try that in a next update.
Just wanted to make sure of 1 thing: in your onFailedToReceiveAd, you basically load a default banner right?
Lol, Jesus is gonna be busy forgiving all of us sinners on this forum!!! May google bless you, with lots of green bank notes!
yes, if anything bad happens (due to android fragmentation) then we are showing SMART_BANNER whose height is less on bigger devices and is less noted by users. SMART_BANNER readjusts itself but not to 468x60 or 728x90
Thank for the info. In my apps I’m getting 1% CTR with the lowest refresh interval, so 2%+ is defenitly good. I’ll implement this code and post if my CTR goes up or not.
I’ve fiddled with this code for a while and sadly I can’t see any boost in revenue:(
Anyway I’ve notice that the screen size calculation in your code has a bug. On my SGS2 it returned 3.73 inches when in reality it was 4.23 inches. Here is the code that worked on my devices:
Your code wrong in Nexus 7 (6.7") or similar device. Tablet have system bar at the bottom and the height by display metric will not the real height.
This is my code:
// Get screen size
int screen_width = 480;
int screen_height = 800;
DisplayMetrics metrics = new DisplayMetrics();
this.getWindowManager().getDefaultDisplay().getMetrics(metrics);
if (Build.VERSION.SDK_INT >= 11) {
Point size = new Point();
try {
this.getWindowManager().getDefaultDisplay().getRealSize(size);
screen_width = size.x;
screen_height = size.y;
} catch (NoSuchMethodError e) {
Log.i("error", "it can't work");
screen_height = this.getWindowManager().getDefaultDisplay().getHeight();
}
} else {
screen_width = metrics.widthPixels;
screen_height = metrics.heightPixels;
}
getWindowManager().getDefaultDisplay().getMetrics(metrics);
double x = Math.pow(screen_width/metrics.xdpi,2);
double y = Math.pow(screen_height/metrics.ydpi,2);
double screenInches = Math.sqrt(x+y);
Log.d("debug","Screen inches : " + screenInches);