Ads mod and starter version

Hi,

I newbie in Corona and i am developing my first application. The problem is that i want to include a banner and i do all right, i link the application in maket place and all is correct but when i put the init code in the application nothing happens.

I believe that the error may be that i am working with corona starter version and i need pro, ¿someone can confirm it?

Starter accounts can use advertising in their apps.

Many ads don’t work in the simulator.  You have to setup accounts with the ad provider you want to use and get the necessary codes from the ad provider and then you have to have things setup in your app.

Can you post your build.settings and config.lua?

Rob

Thanks Rob for the quickly response,

This is my build.settings :

settings =
{
 orientation =
 {
  default = “landscape”,
  supported = { “landscape” }
 },

 androidPermissions =
    {
            “android.permission.INTERNET”,
            “android.permission.ACCESS_NETWORK_STATE”,
            “android.permission.ACCESS_WIFI_STATE”,
            “android.permission.READ_PHONE_STATE”,
    },
 
  – enable the admob plugin
        plugins =
        {
                [“CoronaProvider.ads.admob”] =
                {
                        – required
                        publisherId = “com.coronalabs”,
                },
        },    

}

And this is my config.lua:

application =
{
 content =
 {
  width = 320,
  height = 480,
  scale = “letterbox”,
 }
}

I done all other things that you comment. I have the id from the ad provider (google), setup the account, …
 

Have you tried your app on a device yet?  Can you post your code where you are initializing the ads module and where you are trying to show the ads?

Yes I try the App in the device and don’t go.

I put the code different parts but finally in main.lua :

local storyboard = require “storyboard”
local ads = require (“ads”)

DebugText = display.newEmbossedText(" DEBUG. :", 0, 0, “Arial”, 12)
DebugText.x, DebugText.y = display.contentWidth / 2, 20 
DebugText:setFillColor(255,255,255)
local color =
{
    highlight = { r=1, g=1, b=0, a=200 },
    shadow = { r=1, g=0, b=0, a=128 }
}

DebugText:setEmbossColor(color)

– hide device status bar
display.setStatusBar( display.HiddenStatusBar )

– SHOW BANNER

function adListener( event )
 local msg = event.response
    if event.isError then
      – Failed to receive an ad, we print the error message returned from the library.
        print(msg)
       reclame1 = display.newRect(0, 0, 320, 48)
  reclame1:setFillColor(255, 255, 0)
  reclame1:toFront() 
  DebugText.text = DebugText.text … “Error loading google ads”
    else
     DebugText.text = DebugText.text … “Sucess loading google ads”
    end
end

DebugText.text = DebugText.text … “Initializing google ads”
print(“Initializing google ads”)
ads.init( “adMob”, “--------------------------------hide—”, adListener )
local adsx = display.contentWidth * 0.5
local adsy = display.contentHeight - 25
ads.show( “banner”, { x=adsx, y=adsy , interval=60, testmode =false})

storyboard.gotoScene( “menu”,“zoomOutInFade”, 500 )

Are you getting anything in your DebugText? 

Are you seeing your reclame1 box being drawn? 

Are you seeing any errors in your console log?  If you don’t know how to look , please read: http://www.coronalabs.com/blog/2013/07/09/tutorial-basic-debugging/

You might want to do more prints in your adListener to see what the event table has in it.  Also, ads.show for adMob does not use testmode and interval.  You can remove those two.  They just use x and y.

Rob

Thanks for all Rob,

I found my error. Case sensitive problema in the line

ads.init( “adMob”, “--------------------------------hide—”, adListener )

must be

ads.init(“admob”,

I’m really happy

Starter accounts can use advertising in their apps.

Many ads don’t work in the simulator.  You have to setup accounts with the ad provider you want to use and get the necessary codes from the ad provider and then you have to have things setup in your app.

Can you post your build.settings and config.lua?

Rob

Thanks Rob for the quickly response,

This is my build.settings :

settings =
{
 orientation =
 {
  default = “landscape”,
  supported = { “landscape” }
 },

 androidPermissions =
    {
            “android.permission.INTERNET”,
            “android.permission.ACCESS_NETWORK_STATE”,
            “android.permission.ACCESS_WIFI_STATE”,
            “android.permission.READ_PHONE_STATE”,
    },
 
  – enable the admob plugin
        plugins =
        {
                [“CoronaProvider.ads.admob”] =
                {
                        – required
                        publisherId = “com.coronalabs”,
                },
        },    

}

And this is my config.lua:

application =
{
 content =
 {
  width = 320,
  height = 480,
  scale = “letterbox”,
 }
}

I done all other things that you comment. I have the id from the ad provider (google), setup the account, …
 

Have you tried your app on a device yet?  Can you post your code where you are initializing the ads module and where you are trying to show the ads?

Yes I try the App in the device and don’t go.

I put the code different parts but finally in main.lua :

local storyboard = require “storyboard”
local ads = require (“ads”)

DebugText = display.newEmbossedText(" DEBUG. :", 0, 0, “Arial”, 12)
DebugText.x, DebugText.y = display.contentWidth / 2, 20 
DebugText:setFillColor(255,255,255)
local color =
{
    highlight = { r=1, g=1, b=0, a=200 },
    shadow = { r=1, g=0, b=0, a=128 }
}

DebugText:setEmbossColor(color)

– hide device status bar
display.setStatusBar( display.HiddenStatusBar )

– SHOW BANNER

function adListener( event )
 local msg = event.response
    if event.isError then
      – Failed to receive an ad, we print the error message returned from the library.
        print(msg)
       reclame1 = display.newRect(0, 0, 320, 48)
  reclame1:setFillColor(255, 255, 0)
  reclame1:toFront() 
  DebugText.text = DebugText.text … “Error loading google ads”
    else
     DebugText.text = DebugText.text … “Sucess loading google ads”
    end
end

DebugText.text = DebugText.text … “Initializing google ads”
print(“Initializing google ads”)
ads.init( “adMob”, “--------------------------------hide—”, adListener )
local adsx = display.contentWidth * 0.5
local adsy = display.contentHeight - 25
ads.show( “banner”, { x=adsx, y=adsy , interval=60, testmode =false})

storyboard.gotoScene( “menu”,“zoomOutInFade”, 500 )

Are you getting anything in your DebugText? 

Are you seeing your reclame1 box being drawn? 

Are you seeing any errors in your console log?  If you don’t know how to look , please read: http://www.coronalabs.com/blog/2013/07/09/tutorial-basic-debugging/

You might want to do more prints in your adListener to see what the event table has in it.  Also, ads.show for adMob does not use testmode and interval.  You can remove those two.  They just use x and y.

Rob

Thanks for all Rob,

I found my error. Case sensitive problema in the line

ads.init( “adMob”, “--------------------------------hide—”, adListener )

must be

ads.init(“admob”,

I’m really happy