AdMob v2 plugin - Device build error

when i add this to the build.settings 

 plugins = { ["plugin.google.play.services"] = { publisherId = "com.coronalabs" }, }, 

then i get this error when i try to build the app

BuildID: 53ecf8247f629 Error: Get plugin failed. Publisher: com.coronalabs Plugin: plugin.google.play.services

I dont know what to do

Hello @lubomirmolin,

Which version of Corona SDK are you using? If you haven’t upgraded to the latest public build (#2393a) then you should do so before proceeding.

Take care,

Brent

Ok, so the build is now fine but the ads are not showing … 

the code is following… 

local ads = require( "ads" ) local AppID = "ca-app-pub-6794768192988838/4027208302" --for your iOS interstitial local adProvider = "admob" ads.init( adProvider, AppID, adListener ) if ( ads.isLoaded("interstitial") ) then ads.show("interstitial") end

Do you have a function for your adListener?

Your logic also doesn’t make sense.  ads.isLoaded() won’t return true until you have called ads.load(“interstitial”).  You seem to be missing that step.  But even then it’s a bit more complex than simply calling ads.load() because this is an asynchronous operation.  That is ads.load() takes time and runs in the background immediately returning control to your program.   Thus if you do:

ads.load(“interstitial”)

if (ads.isLoaded(“interstitial”) then

    — do stuff

end

The return will always be false because the isLoaded test happens immediately before ads.load() has a chance to actually load the ad.  The right logic is one of two choices:

Ignore pre-loading and just call ads.show(“interstitial”)

This is the simplest option, but the ad shows when it’s ready, and not so much when you want it too.

If you know your going to show the ad at a certain point and can a few seconds earlier preload the ad, call ads.load(“interstitial”) when you have time to load the ad.  Then when you’re ready to actually show the code call your ads.isLoaded/ads.show code above.

Rob

Ok so i have re-did this, 

local provider = "admob" local appID = "MY NUMBER OF COURSE" local ads = require "ads" showAd = function( adType ) local adX, adY = display.screenOriginX, display.screenOriginY statusText.text = "" ads.show( adType, { x=adX, y=adY } ) end if sysEnv == "simulator" then local font, size = native.systemFontBold, 22 local warningText = display.newRetinaText( "Please build for device or Xcode simulator to test this sample.", 0, 0, 290, 300, font, size ) warningText:setTextColor( 255 ) warningText.x, warningText.y = display.contentWidth \* 0.5, display.contentHeight \* 0.5 else -- start with banner ad showAd( "interstitial" ) end

and its not working

You don’t seem to have called ads.init in that example…

Hello @lubomirmolin,

Which version of Corona SDK are you using? If you haven’t upgraded to the latest public build (#2393a) then you should do so before proceeding.

Take care,

Brent

Ok, so the build is now fine but the ads are not showing … 

the code is following… 

local ads = require( "ads" ) local AppID = "ca-app-pub-6794768192988838/4027208302" --for your iOS interstitial local adProvider = "admob" ads.init( adProvider, AppID, adListener ) if ( ads.isLoaded("interstitial") ) then ads.show("interstitial") end

Do you have a function for your adListener?

Your logic also doesn’t make sense.  ads.isLoaded() won’t return true until you have called ads.load(“interstitial”).  You seem to be missing that step.  But even then it’s a bit more complex than simply calling ads.load() because this is an asynchronous operation.  That is ads.load() takes time and runs in the background immediately returning control to your program.   Thus if you do:

ads.load(“interstitial”)

if (ads.isLoaded(“interstitial”) then

    — do stuff

end

The return will always be false because the isLoaded test happens immediately before ads.load() has a chance to actually load the ad.  The right logic is one of two choices:

Ignore pre-loading and just call ads.show(“interstitial”)

This is the simplest option, but the ad shows when it’s ready, and not so much when you want it too.

If you know your going to show the ad at a certain point and can a few seconds earlier preload the ad, call ads.load(“interstitial”) when you have time to load the ad.  Then when you’re ready to actually show the code call your ads.isLoaded/ads.show code above.

Rob

Ok so i have re-did this, 

local provider = "admob" local appID = "MY NUMBER OF COURSE" local ads = require "ads" showAd = function( adType ) local adX, adY = display.screenOriginX, display.screenOriginY statusText.text = "" ads.show( adType, { x=adX, y=adY } ) end if sysEnv == "simulator" then local font, size = native.systemFontBold, 22 local warningText = display.newRetinaText( "Please build for device or Xcode simulator to test this sample.", 0, 0, 290, 300, font, size ) warningText:setTextColor( 255 ) warningText.x, warningText.y = display.contentWidth \* 0.5, display.contentHeight \* 0.5 else -- start with banner ad showAd( "interstitial" ) end

and its not working

You don’t seem to have called ads.init in that example…