AdMob doesn't work

Hello,

I’ve encountered problem when trying to implement AdMob ads to my application.

Every time when I try to load an ad I get the same error:

I/Corona  ( 4432): adListener   type    interstitial
I/Corona  ( 4432): adListener   name    adsRequest
I/Corona  ( 4432): adListener   provider        AdMobProvider
I/Corona  ( 4432): adListener   phase   loaded
I/Corona  ( 4432): adListener   isError true
I/Corona  ( 4432): adListener   response        Something happened internally in the AdmobSDK; for instance, an invalid response w
as received from the ad server.

Here’s the code:

local ads = require("ads") local function adListener(event) for k,v in pairs(event) do print("adListener ", k, v) -- so you see everything you get end end ads.init("admob", 'ca-app-pub-1241820889739638/3252518306', adListener ) ads.load("interstitial", { testMode = true } ) ads.show("interstitial", { testMode = true } )

What should I do to fix it?

Well the ads.show() should have the testMode set to either true or false.  It sounds like AdMob had an internal problem.  I would try again.

Rob

Please download this, change the admob id (in main.lua) to your ID, then run it on your device.

http://github.com/roaminggamer/RG_FreeStuff/raw/master/AskEd/2015/06/admob.zip

 

 

I’m pretty sure it will work unless there is an issue w/ your ID.

Then, compare my code to yours.

That code doesn’t work too. I’ve replaced the ID with mine and got the same error.

Perhaps it’s time you posted the contents of the device’s console log.  If you’re on Android, you will use “adb logcat” to do this. If you need help with this, please read:

http://docs.coronalabs.com/guide/basics/debugging/index.html

Rob

@crypton01,

Hi.  Let’s see if we can get you un-stuck.

What I Did Before Posting This

  1.  I used the code at this link: http://github.com/roaminggamer/RG_FreeStuff/raw/master/AskEd/2015/06/admob.zip

  2. I changed line 8 from this:

    local bannerID = “ADMOBIDGOESHERE” 

to this:

local bannerID = "ca-app-pub-1241820889739638/3252518306"

  1. I built it for Android, using Corona 2015.2652 and the debug.keystore that comes with Corona.

  2. I installed it on my Gen 1 Nexus 7, and it worked fine.

Questions For You

  1. Have you followed steps like those above?

  2. Are you testing this on a device?  It won’t work in the simulator.

  3. What does the logcat output say?  If you don’t know what this means, please follow the debugging instructions at Rob’s posted link above.

  1. Yes, downloaded that code, changed line 8 to my ID, built it with 2015.2646 and default debug keystore.

  2. I’m testing on 2 devices - Xiaomi MI3, Xiaomi MiPad

  3. The logcat output says the same as above:

I/Ads     ( 9022): CsiReporterFactory: CSI is not enabled. No CSI reporter created.
I/Ads     ( 9022): Starting ad request.
I/Ads     ( 9022): Please set theme of AdActivity to @android:style/Theme.Translucent to enable transparent background interstitia
l ad.
I/Ads     ( 7545): CsiReporterFactory: CSI is not enabled. No CSI reporter created.
E/Ads     ( 7545): JS: Not allowed to load local resource: file:///android_asset/webkit/android-weberror.png (data:text/html,chrom
ewebdata:12)
W/Ads     ( 9022): There was a problem getting an ad response. ErrorCode: 0
W/Ads     ( 9022): Failed to load ad: 0

I/Corona  ( 8694): adListener   type    banner
I/Corona  ( 8694): adListener   name    adsRequest
I/Corona  ( 8694): adListener   provider        AdMobProvider
I/Corona  ( 8694): adListener   phase   loaded
I/Corona  ( 8694): adListener   isError true
I/Corona  ( 8694): adListener   response        Something happened internally in the AdmobSDK; for instance, an invalid response was received from the ad server.

I’ve fixed the problem. I’ve updated the phone and tablet software to newest version.

What was the fix?

Well the ads.show() should have the testMode set to either true or false.  It sounds like AdMob had an internal problem.  I would try again.

Rob

Please download this, change the admob id (in main.lua) to your ID, then run it on your device.

http://github.com/roaminggamer/RG_FreeStuff/raw/master/AskEd/2015/06/admob.zip

 

 

I’m pretty sure it will work unless there is an issue w/ your ID.

Then, compare my code to yours.

That code doesn’t work too. I’ve replaced the ID with mine and got the same error.

Perhaps it’s time you posted the contents of the device’s console log.  If you’re on Android, you will use “adb logcat” to do this. If you need help with this, please read:

http://docs.coronalabs.com/guide/basics/debugging/index.html

Rob

@crypton01,

Hi.  Let’s see if we can get you un-stuck.

What I Did Before Posting This

  1.  I used the code at this link: http://github.com/roaminggamer/RG_FreeStuff/raw/master/AskEd/2015/06/admob.zip

  2. I changed line 8 from this:

    local bannerID = “ADMOBIDGOESHERE” 

to this:

local bannerID = "ca-app-pub-1241820889739638/3252518306"

  1. I built it for Android, using Corona 2015.2652 and the debug.keystore that comes with Corona.

  2. I installed it on my Gen 1 Nexus 7, and it worked fine.

Questions For You

  1. Have you followed steps like those above?

  2. Are you testing this on a device?  It won’t work in the simulator.

  3. What does the logcat output say?  If you don’t know what this means, please follow the debugging instructions at Rob’s posted link above.

  1. Yes, downloaded that code, changed line 8 to my ID, built it with 2015.2646 and default debug keystore.

  2. I’m testing on 2 devices - Xiaomi MI3, Xiaomi MiPad

  3. The logcat output says the same as above:

I/Ads     ( 9022): CsiReporterFactory: CSI is not enabled. No CSI reporter created.
I/Ads     ( 9022): Starting ad request.
I/Ads     ( 9022): Please set theme of AdActivity to @android:style/Theme.Translucent to enable transparent background interstitia
l ad.
I/Ads     ( 7545): CsiReporterFactory: CSI is not enabled. No CSI reporter created.
E/Ads     ( 7545): JS: Not allowed to load local resource: file:///android_asset/webkit/android-weberror.png (data:text/html,chrom
ewebdata:12)
W/Ads     ( 9022): There was a problem getting an ad response. ErrorCode: 0
W/Ads     ( 9022): Failed to load ad: 0

I/Corona  ( 8694): adListener   type    banner
I/Corona  ( 8694): adListener   name    adsRequest
I/Corona  ( 8694): adListener   provider        AdMobProvider
I/Corona  ( 8694): adListener   phase   loaded
I/Corona  ( 8694): adListener   isError true
I/Corona  ( 8694): adListener   response        Something happened internally in the AdmobSDK; for instance, an invalid response was received from the ad server.

I’ve fixed the problem. I’ve updated the phone and tablet software to newest version.

What was the fix?