cordova-plugin-admob-free icon indicating copy to clipboard operation
cordova-plugin-admob-free copied to clipboard

plugin always show testing ads

Open Serizao opened this issue 8 years ago • 29 comments
trafficstars

Hello,

I try to use the free admob plugin but it always show testing ads this is my code :


  admob.interstitial.config({
id: 'ca-app-pub-APP_ID',
autoShow: false
})

admob.interstitial.prepare()
admob.interstitial.show()


 });

do you now why the plugin do this ?

Serizao avatar May 18 '17 14:05 Serizao

please look at https://github.com/ratson/cordova-plugin-admob-free/blob/master/src/android/AdMobConfig.java#L228-L248

Please set your id always.

centrual avatar May 18 '17 17:05 centrual

@wleberre Is your app running on real device?

ratson avatar May 19 '17 14:05 ratson

yes it is the only for ads working is to set directly id in this : https://github.com/ratson/cordova-plugin-admob-free/blob/master/src/ios/CDVAdMob.m#L50L52

Serizao avatar May 20 '17 08:05 Serizao

@wleberre Would you let me know what is the value of console.log(admob.interstitial._config) just before your are calling admob.interstitial.prepare()?

ratson avatar May 20 '17 15:05 ratson

it do an error :

            Property '_config' does not exist on type 'AdMobFreeInterstitial'. 

      L89:  console.log(admob.interstitial._config)
      L90:  admob.interstitial.prepare()

[15:20:03]  ionic-app-script task: "build" 
[15:20:03]  Error: Failed to transpile program 
Error: Failed to transpile program
    at BuildError.Error (native)
    at new BuildError (/Users/william/Desktop/popote/popote/node_modules/@ionic/app-scripts/dist/util/errors.js:16:28)
    at /Users/william/Desktop/popote/popote/node_modules/@ionic/app-scripts/dist/transpile.js:137:20
    at transpileWorker (/Users/william/Desktop/popote/popote/node_modules/@ionic/app-scripts/dist/transpile.js:103:12)
    at Object.transpile (/Users/william/Desktop/popote/popote/node_modules/@ionic/app-scripts/dist/transpile.js:61:12)
    at buildProject (/Users/william/Desktop/popote/popote/node_modules/@ionic/app-scripts/dist/build.js:97:78)
    at /Users/william/Desktop/popote/popote/node_modules/@ionic/app-scripts/dist/build.js:47:16
```

Serizao avatar May 21 '17 13:05 Serizao

@ratson I put directly console.log in admobjs (https://github.com/ratson/cordova-plugin-admob-free/blob/master/src/js/interstitial.js#L55L56) for see options result :

{"interstitialAdId":"ca-app-pub-MY-ID","isTesting":false,"autoShow":true}

Serizao avatar May 22 '17 04:05 Serizao

I'll check it soon.

centrual avatar May 23 '17 12:05 centrual

@wleberre Is your printed result before or after delete options.id? If it is after, that is what I was expecting, is the above all your ad calls?

ratson avatar May 24 '17 15:05 ratson

it return : undefined

Serizao avatar May 26 '17 12:05 Serizao

if i running ionic cordova run android, are showing real adds, but if i run ionic cordova run android --prepare - are showing only test ads any suggestions?

caciobanita avatar May 29 '17 20:05 caciobanita

Hi wleberre,

I've got the same problem. Test ads are always showing, even when I've built and signed a release APK.

My ad config is as bellow:

const bannerConfig: AdMobFreeBannerConfig = {
    // add your config here
    // for the sake of this example we will just use the test config
    autoShow: true,
    id: credentials.androidBanner
};

Did you solve this?

jjohnson1994 avatar Jun 04 '17 14:06 jjohnson1994

You test it on android emulator? If yes that's normal But me i don't arrive to resolve this . And you put your admob id in AdMobFreeBannerConfig ?

Serizao avatar Jun 04 '17 15:06 Serizao

When testing on an emulator/ debug APK I get the test ads, thats okay.

I've built and signed my app for release and am testing on a device but still get the test ads.

jjohnson1994 avatar Jun 04 '17 16:06 jjohnson1994

what say the log about it ?

Serizao avatar Jun 05 '17 12:06 Serizao

There's nothing in the log, presumably because there is no error/ warning so nothing to log. AdMob things it's doing what it should be?

jjohnson1994 avatar Jun 06 '17 08:06 jjohnson1994

Do you use android studio for see log of app while it running

Serizao avatar Jun 06 '17 09:06 Serizao

No I'm running the app with ionic cordova run android -lcs. I'm also trying this building the app for release, signing, and installing like a regular app.

jjohnson1994 avatar Jun 06 '17 10:06 jjohnson1994

can you try with ionic cordova emulate android and android studio i think it log more event than ionic

Serizao avatar Jun 06 '17 10:06 Serizao

But emulating will show the test adverts, which isn't a problem. My problem is that test adverts are shown in a release app.

jjohnson1994 avatar Jun 06 '17 12:06 jjohnson1994

Try this:

var admobid = {
banner: 'YOUR BANNER ID',
interstitial: 'YOUR INTERSTITIAL ID',
}

document.addEventListener('deviceready', function() {
  admob.banner.config({
    id: admobid.banner,
    isTesting: false,
    autoShow: true,
  })
  admob.banner.prepare()

  admob.interstitial.config({
    id: admobid.interstitial,
    isTesting: false,
    autoShow: true,
  })
  admob.interstitial.prepare()

}, false)

geekyguy18 avatar Jun 10 '17 08:06 geekyguy18

showBanner() { let bannerConfig: AdMobFreeBannerConfig = { isTesting: false, autoShow: true, id: 'ca-app-pub-ID' };

this.admob.banner.config(bannerConfig); this.admob.banner.prepare().then(() => { }).catch(e => console.log(e));

Same here, only test mode.

rexuli avatar Jul 03 '17 15:07 rexuli

not sure if I was having the same issue as you guys are having, but it seems if you try to inject admobFree into multiple view models in ionic 2, you need to make sure none of them have isTesting set to true in config object. i forgot to remove that in one of the view models and was seeing test ads in my published app too. also it could have something to do with that it takes a bit for actual live ads to start rendering, it depends on the available for your location and device ads content.

classicalConditioning avatar Jul 07 '17 21:07 classicalConditioning

What is the solution for this? I am also stuck with the same issue. This is my code

configBanner : function(){
      admob.setOptions({
        publisherId : 'MY PUB ID',
      });
      admob.banner.config({
        id: admobid.banner,
        publisherId : 'MY PUB ID',
        isTesting : false,
        overlap : true,
        size : 'BANNER'
      });
      // Create banner
      admob.banner.prepare();

    },

My plugin lists

cordova-admob-sdk 0.18.0 "AdMob SDK"
cordova-plugin-admob-free 0.18.0 "Cordova AdMob Plugin"
cordova-plugin-admob-mediation-inmobi 1.0.0 "AdMob Mediation Adapter for InMobi"
cordova-plugin-network-information 2.0.1 "Network Information"
cordova-plugin-whitelist 1.3.3 "Whitelist"
cordova-plugin-x-socialsharing 5.4.1 "SocialSharing"
cordova-plugin-x-toast 2.6.2 "Toast"
cordova-promise-polyfill 0.0.2 "cordova-promise-polyfill"
es6-promise-plugin 4.2.2 "Promise"

zusamarehan avatar Sep 02 '18 19:09 zusamarehan

Any update on this? It's been several months now. Any of you managed to get this to work properly?

evinkuraga avatar May 14 '19 19:05 evinkuraga

it still happen.....everyone has this problem?

kotran88 avatar Oct 11 '20 14:10 kotran88

same issue

Lmendev avatar Dec 07 '20 19:12 Lmendev

now I am using another plugin because this one never worked for me

Lmendev avatar Dec 21 '20 18:12 Lmendev

What did you end up using ?

evinkuraga avatar Dec 21 '20 20:12 evinkuraga

I am using AdMob Plus https://admob-plus.github.io/docs/

Lmendev avatar Jan 04 '21 13:01 Lmendev