Ads displayed on screen or content?

My screen content is much larger than the 3GS screen by almost double, so the content is scaled down. But when I do an “ads.show” it looks like the ad shown is not placed in the content because its not scaled at all. Is that how it’s supposed to be? If that is true, how do you get the screen resolution? I don’t see any functions for it except for getting the original content size.

Thanks! [import]uid: 99244 topic_id: 17809 reply_id: 317809[/import]

You can check what model a person is using and adjust accordingly, like so;

[lua]system.getInfo(“model”)[/lua]

Link: http://developer.anscamobile.com/reference/index/systemgetinfo

Peach :slight_smile: [import]uid: 52491 topic_id: 17809 reply_id: 68108[/import]

Hi Peach, I don’t think that will be enough. Android phones are way too many different sizes. Plus “iPhone” has retina and non-retina, and soon that will be true for iPad.

Is there any way to get the device’s screen size? Since ads seem dependent on it, I think it’s necessary. [import]uid: 99244 topic_id: 17809 reply_id: 68129[/import]

You use [lua]display.contentHeight[/lua] and [lua]display.contentWidth[/lua] to get height and width of the screen. When you have Dynamic Scaling on (in config.lua), these numbers will reflect the scaled values and not the actual screen size. You can read the scale factor using [lua]display.contentScaleX[/lua] and [lua]display.contentScaleY[/lua] to determine the actual screen size. If your config.lua sets the content to 320x480 and app is run on an iPhone4, the scale factor for scaleX and scaleY will be 0.5 (half size). On an iPhone 3GS it will be 1.0 (actual size).

As far as the ads are concerned on iOS devices, they are not affected by Dynamic Scaling. For iOS their size is in points, not pixels. This means a 320x48 ad on a 3GS will be 320x48 pixels. On iPhone4 it will be 640x96 pixels (1 point = 2 pixels).
[import]uid: 7559 topic_id: 17809 reply_id: 68185[/import]

Just a follow up question on getting the actual screen size.

If I use 320x480 in the config.lua file along with the scale of either “zoomEven” or “letterbox” and then test it on an iPad their scaling factors do not reflect the sizes of the screen (one side does, but the other side is either too short or too long). The scaling values make sense, but now there does not seem to be way to get the true screen size in a consistent manner.

It seems like if I use “zoomStretch” in the config.lua file it will work, but is there another way to get it without using that? [import]uid: 37876 topic_id: 17809 reply_id: 70868[/import]