Steps involved with using AdMob

Can anyone tell me the steps involved in implementing AdMod into my application? I don’t feel like it is explained well enough anywhere.

Thankyou.

Farid.

  1. Create an account with AdMob.

  2. Create an app with AdMob and get an AppID (ProviderID)

  3. In your build.settings, include the plugin code (http://docs.coronalabs.com/plugin/ads-admob/index.html)

  4. in your main.lua, init the library.

  5. Where you need to show the library call ad.show().  See:

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

for sample code for all of this.

This is exactly what I was looking for. Thanks a million for your help Rob.

Farid.

One thing, is a provider ID the same as a publisher ID?

I believe that’s correct.

-- CODE IN MY build.settings settings = { orientation = { default = "landscapeRight", supported = { "landscapeLeft", "landscapeRight" }, }, android = { versionCode = "11" }, androidPermissions = { "android.permission.INTERNET", "android.permission.WRITE\_EXTERNAL\_STORAGE", "android.permission.ACCESS\_NETWORK\_STATE", "android.permission.READ\_PHONE\_STATE", }, build = { neverStripDebugInfo = true }, plugins = { -- key is the name passed to Lua's 'require()' ["CoronaProvider.ads.admob"] = { -- required publisherId = "com.coronalabs", }, }, } -- CODE IN MY main.lua provider = "admob" appID = "ca-app-pub-XXX/XXX" AD\_TYPE = "interstitial" -- CODE IN MY HomeScreen.lua local adsObject = require ("ads") local toast = require ("toast") local function adListener( event ) local msg = event.response toast.new("Event Msg: "..msg, 2000) print("Message received from the ads library: ", msg) local statusText = display.newText( "", 0, 0, native.systemFontBold, 22 ) statusText:setTextColor(153, 0, 51) statusText.x, statusText.y = display.contentWidth \* 0.5, 160 if event.isError then IS\_ADD\_INIT = false toast.new("--FALSE--", 2000) statusText.text = "Error: "..msg; else toast.new("--TRUE--", 2000) IS\_ADD\_INIT = true statusText.text = "Success: "..msg; adsObject.show( AD\_TYPE , { x=centerX, y=centerY } ) end end function scene:enterScene( event ) local group=self.view if appID then adsObject.init( provider, appID, adListener ) else toast.new("NO APP ID", 2000) end end

PLEASE HELP.

I AM NOT ABLE TO LOAD ADS WITH THE ABOVE CODE.

my adListener(event) never gets called.

Please correct me!

  1. Create an account with AdMob.

  2. Create an app with AdMob and get an AppID (ProviderID)

  3. In your build.settings, include the plugin code (http://docs.coronalabs.com/plugin/ads-admob/index.html)

  4. in your main.lua, init the library.

  5. Where you need to show the library call ad.show().  See:

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

for sample code for all of this.

This is exactly what I was looking for. Thanks a million for your help Rob.

Farid.

One thing, is a provider ID the same as a publisher ID?

I believe that’s correct.

-- CODE IN MY build.settings settings = { orientation = { default = "landscapeRight", supported = { "landscapeLeft", "landscapeRight" }, }, android = { versionCode = "11" }, androidPermissions = { "android.permission.INTERNET", "android.permission.WRITE\_EXTERNAL\_STORAGE", "android.permission.ACCESS\_NETWORK\_STATE", "android.permission.READ\_PHONE\_STATE", }, build = { neverStripDebugInfo = true }, plugins = { -- key is the name passed to Lua's 'require()' ["CoronaProvider.ads.admob"] = { -- required publisherId = "com.coronalabs", }, }, } -- CODE IN MY main.lua provider = "admob" appID = "ca-app-pub-XXX/XXX" AD\_TYPE = "interstitial" -- CODE IN MY HomeScreen.lua local adsObject = require ("ads") local toast = require ("toast") local function adListener( event ) local msg = event.response toast.new("Event Msg: "..msg, 2000) print("Message received from the ads library: ", msg) local statusText = display.newText( "", 0, 0, native.systemFontBold, 22 ) statusText:setTextColor(153, 0, 51) statusText.x, statusText.y = display.contentWidth \* 0.5, 160 if event.isError then IS\_ADD\_INIT = false toast.new("--FALSE--", 2000) statusText.text = "Error: "..msg; else toast.new("--TRUE--", 2000) IS\_ADD\_INIT = true statusText.text = "Success: "..msg; adsObject.show( AD\_TYPE , { x=centerX, y=centerY } ) end end function scene:enterScene( event ) local group=self.view if appID then adsObject.init( provider, appID, adListener ) else toast.new("NO APP ID", 2000) end end

PLEASE HELP.

I AM NOT ABLE TO LOAD ADS WITH THE ABOVE CODE.

my adListener(event) never gets called.

Please correct me!