Showing Ads at the Bottom

Hi, I’m trying to show ads at the bottom of the screen. Here is my code:

[lua]local ads = require(“ads”)
local bottom_y = display.contentHeight - display.screenOriginY
ads.init(“inmobi”, “4028cba631d63df10131e1d3191d00cb”)
ads.show(“banner320x48”, {x=0, y=bottom_y-48, testMode=true})[/lua]

I set the scaling mode to letterbox, and the display content size is set to 480x320.
It appears perfectly on my phone (which has a 854x480 screen):

But not good on my Nexus 7 (which has a 1280x800 screen):

I read the documentation of inmobi and found that the banner size “320x48” is not pixel size but “display point”, which have to be convert to pixel size by following calculation:
[java]
final float scale = getResources().getDisplayMetrics().density;
int width = (int) (320 * scale + 0.5f);
int height = (int) (48 * scale + 0.5f);
[/java]

Is there any way to obtain the density? Or is there any other way to make ads appear at the center bottom of the screen? [import]uid: 153022 topic_id: 31131 reply_id: 331131[/import]