Inmobi Ads Sizes on Android

Hi all,

 I’m using the Basic license of Corona SDK. I created a project with inMobi Provider Plugin:

 http://docs.coronalabs.com/daily/plugin/ads-inmobi/index.html

All is working fine on smartphones, but on Tablets I can’t see the interstitial and the banners with the right size. I mean, on Tablets the sizes are the same sizes than on a Smartphone, so the interstitial is not at full screen and the banner shows very small.

In the sample project, they resolve this only in iOS:

https://github.com/coronalabs/plugins-sample-ads-InMobi

But, what can I do to show the correct sizes on Android Tablets?

This is my code for the banner:

–Inmmobi

 

local adNetwork = “inmobi”

local ads = require “ads”

 

–Banner

 

local appID = “xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx”

 

 

ads.init( adNetwork, appID )

 

        ads.show( “banner”,

        {

            x = (display.contentWidth / 24),

            y = 0,

            interval = 40,

            testMode = false 

        })

And this for the interstitial:

 --Inmmobi

 

local adNetwork = “inmobi”

local ads = require “ads”

 

 – Interstitial

 

local appID = “xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx”

 

 ads.init( adNetwork, appID )

 

        ads.show( “Interstitial”,

        {

            x = display.contentWidth / 2,

            y = display.contentHeight / 2,

            interval = 30,

            testMode = false

        })

 Any idea?

 I’ll appreciate any help in this regard.

Thanks a lot.

Hello @miguel.perotti,

It appears that you’re not setting the correct ad type values, as outlined in the following documentation.

http://docs.coronalabs.com/daily/plugin/ads-inmobi/show.html

For example, you’re setting “Interstitial” instead of “interstitial” (notice case-sensitive). And you’re simply setting “banner” when the option should be something like “banner320x50” or one of the options shown in the docs.

Hope this helps,

Brent

Thanks a lot Brent.

 You are right. I was setting “Interstitial” instead of “interstitial” .

 For others who may be interested, I have found very useful the information in this thread in order to change the size of the banners depending on the type of Android device:

 http://forums.coronalabs.com/topic/33167-how-to-position-an-ad-on-the-center-of-the-screen/

 Especially the code that shares the user petiflas:

height_device=math.round(display.contentHeight*(1/display.contentScaleY))

width_device=math.round(display.contentWidth*(1/display.contentScaleX))

 

if width_device >= 728 then 

    adType = “banner728x90”

    adX=(width_device-728)/2

    adY=0  --change to (adY=height_device-90) for position botton center

else

    adType = “banner320x48”

    adX=(width_device-320)/2

    adY=0 --change to (adY=height_device-48) for position botton center

end

 

ads.show( adType, { x=adX, y=adY, interval=5, testMode=true } )

 Thanks!

Hello @miguel.perotti,

It appears that you’re not setting the correct ad type values, as outlined in the following documentation.

http://docs.coronalabs.com/daily/plugin/ads-inmobi/show.html

For example, you’re setting “Interstitial” instead of “interstitial” (notice case-sensitive). And you’re simply setting “banner” when the option should be something like “banner320x50” or one of the options shown in the docs.

Hope this helps,

Brent

Thanks a lot Brent.

 You are right. I was setting “Interstitial” instead of “interstitial” .

 For others who may be interested, I have found very useful the information in this thread in order to change the size of the banners depending on the type of Android device:

 http://forums.coronalabs.com/topic/33167-how-to-position-an-ad-on-the-center-of-the-screen/

 Especially the code that shares the user petiflas:

height_device=math.round(display.contentHeight*(1/display.contentScaleY))

width_device=math.round(display.contentWidth*(1/display.contentScaleX))

 

if width_device >= 728 then 

    adType = “banner728x90”

    adX=(width_device-728)/2

    adY=0  --change to (adY=height_device-90) for position botton center

else

    adType = “banner320x48”

    adX=(width_device-320)/2

    adY=0 --change to (adY=height_device-48) for position botton center

end

 

ads.show( adType, { x=adX, y=adY, interval=5, testMode=true } )

 Thanks!