ratson / cordova-plugin-admob-free

New development has been moved to "admob-plus-cordova", https://github.com/admob-plus/admob-plus/tree/master/packages/cordova
https://github.com/admob-plus/admob-plus
MIT License
499 stars 214 forks source link

plugin always show testing ads #69

Open Serizao opened 7 years ago

Serizao commented 7 years ago

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 ?

centrual commented 7 years ago

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

Please set your id always.

ratson commented 7 years ago

@wleberre Is your app running on real device?

Serizao commented 7 years ago

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

ratson commented 6 years ago

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

Serizao commented 6 years ago

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 commented 6 years ago

@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}
centrual commented 6 years ago

I'll check it soon.

ratson commented 6 years ago

@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?

Serizao commented 6 years ago

it return : undefined

caciobanita commented 6 years ago

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?

jjohnson1994 commented 6 years ago

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?

Serizao commented 6 years ago

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 ?

jjohnson1994 commented 6 years ago

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.

Serizao commented 6 years ago

what say the log about it ?

jjohnson1994 commented 6 years ago

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?

Serizao commented 6 years ago

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

jjohnson1994 commented 6 years ago

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.

Serizao commented 6 years ago

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

jjohnson1994 commented 6 years ago

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

geekyguy18 commented 6 years ago

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)
rexuli commented 6 years ago

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.

classicalConditioning commented 6 years ago

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.

zusamarehan commented 5 years ago

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"
evinkuraga commented 5 years ago

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

kotran88 commented 3 years ago

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

Lmendev commented 3 years ago

same issue

Lmendev commented 3 years ago

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

evinkuraga commented 3 years ago

What did you end up using ?

Lmendev commented 3 years ago

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