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

Not showing ads after update #119

Closed erperejildo closed 6 years ago

erperejildo commented 6 years ago

Not sure if this is a problem of this library or it's related to Ionic. Either way I created an issue on Ionic repo but I'd like to leave here the link just to double check if someone else is facing the same issue: https://github.com/ionic-team/ionic-native/issues/2091

Resuming: I can't get this library working with latest version of Ionic (3.7.1). It doesn't display anything and only when I force it to be displayed through the terminal it display a black container.

erperejildo commented 6 years ago

No ideas?

fobaz commented 6 years ago

Maybe this is related? https://github.com/ratson/cordova-plugin-admob-free/issues/120

erperejildo commented 6 years ago

Might be more related with this one: https://github.com/ratson/cordova-plugin-admob-free/issues/118 I don't get any issue here, just no banner at all, but the code seems correct. At least it was working as a charm before updates as I comment

bentzibentz commented 6 years ago

Any news on that?

erperejildo commented 6 years ago

@bentzibentz are you facing the same? I tried several tutorials using different approach and also starting from scratch. The last thing I haven't tried is with the other plugin, the pro one. But I'd prefer to keep using this one.

5HARK commented 6 years ago

@erperejildo when i tested it on the pure empty cordova project. it works well. I proceeded in the following order.

  1. Make empty cordova project.
  2. Inject cordova-plugin-admob-free example codes (https://github.com/ratson/cordova-plugin-admob-free/tree/master/examples/basic)
  3. Test it on Android Emulator.
  4. It works well without any problems.(Banner & Interstitial Ads)

I think, this problem is related to ionic or angular. but not sure.

5HARK commented 6 years ago

I just tried it again and it works well in my ionic3 + angular4 project.

Below are the tasks I did.

and it works.

erperejildo commented 6 years ago

Ok @5HARK I'll try again but as commented this happened to me because I updated everything. I'm using Cordova 7.1.0 which is the latest version: https://www.npmjs.com/package/cordova

I updated, removed node_modules folder, cleaned cache, I ran cordova prepare and I tried on Mac and Windows. The only thing I haven't tried is with the emulator.

Tbh I'm almost sure the problem is not this plugin because I also tried the paid one with the same behaviour: doesn't display any banner.

erperejildo commented 6 years ago

Ok, just tried with the emulator and works. We are using Ionic and Angular here as well so I don't know what the problem is.

@ratson any ideas?

ratson commented 6 years ago

As mentioned in https://github.com/ratson/cordova-plugin-admob-free#ionic-support, I don't know much about Ionic, which I have no idea what's wrong.

@erperejildo If you prepare a repo with minimum example showing the problem, I would take a look and see if any I could help.

erperejildo commented 6 years ago

Sure, I will create a smaller repo with this issue now and the steps to reproduce it

erperejildo commented 6 years ago

Ok, I prepared this repo @ratson: https://github.com/erperejildo/admob-free-ionic One thing, I said that it was working with the emulator and it's not. I tried with the other plugin (the paid one).

As you can see after run it on the emulator or directly on the phone (haven't tried this yet, I'm at work) doesn't display anything. I cannot see any issue on the console

ratson commented 6 years ago

@erperejildo I updated the dependencies and tested on my Android device, it shows the banner.

screen

Here is my code: https://github.com/ratson/admob-free-ionic

erperejildo commented 6 years ago

I tried this:

So I understand there are some conflicts with other packages. What I'd do is from my package.json start adding one by one and let's what happens

erperejildo commented 6 years ago

I've changed the package.json on the repo as well: https://github.com/erperejildo/admob-free-ionic/blob/master/package.json

ratson commented 6 years ago

@erperejildo Did you find out which plugin causing the issue? I am not going to testing one by one. I see you have included cordova-plugin-admobpro, which likely be the problem as both interact with admob.

erperejildo commented 6 years ago

No, I haven't found it yet. I was trying right now in fact. I'm having a lot of permission issues (Mac and Windows) and I don't know why.

Yes, when I couldn't get this working with this one I decided to try that one out to double check it wasn't an Admob issue.

I'll keep you updated

erperejildo commented 6 years ago

@ratson this is being quite complex to debug. I'm just removing one by one, removing the whole node_modules folder and running ionic cordova prepare again.

At some point it worked, it just showed up the banner but when I did exactly the same on my project with that package.json (I was trying on the demo project with the big package.json) it didn't work.

And (which is more weird) when I tried again on the demo project didn't work.

Would be maybe another way to find this issue? What about if I modify something on your plugin that maybe you think it might be a potencial issue or... I don't know, maybe try a different approach. Any sugestiong?

trfife commented 6 years ago

I'm having a similar issue. When I hook my phone to logcat I get these errors:

1-30 23:18:14.783 3796-3796/io.ionic.starter W/Ads: Failed to load ad: 2 11-30 23:18:14.783 3796-3796/io.ionic.starter D/CordovaWebViewImpl: >>> loadUrl(javascript:cordova.fireDocumentEvent('admob.banner.events.LOAD_FAIL',{"error":2,"reason":"Network Error","adType":"banner"});) 11-30 23:18:14.784 3796-3796/io.ionic.starter D/CordovaWebViewImpl: >>> loadUrl(javascript:cordova.fireDocumentEvent('onFailedToReceiveAd',{"error":2,"reason":"Network Error","adType":"banner"});)

I'm going to try an empty app and see if it's not working.

erperejildo commented 6 years ago

Might be a different one maybe because I don't get any errors at all, but try that, a new project and use on that project your package.json from the real project

devmartinez0 commented 6 years ago

Recently I had a similar issue. The problem was that my app was in the Designed for Families program of Google (in the Google Play Console settings).

Removing my app from this program solved the issue. Apparently ads not show when you are in this program.

erperejildo commented 6 years ago

Well, mine is in Designed for Families program as well, but tbh that's not related with local deployment or even less with test banners. And also doesn't make any sense because you still having the option on your developer console to check if you app is displaying ads or not.

I found this:

If you have opted your app(s) in to Google Play's Designed for Families program and you show ads in your app(s), you need to ensure those ads comply with the Designed for Families program requirements and ad policies. AdMob offers the following tools for publishers to show ads that are compliant with the Designed for Families program policies.

More info: https://support.google.com/admob/answer/6223431?hl=en

If you fail to comply with these policies without permission from Google, we reserve the right to disable ad serving to your app and/or disable your AdMob account at any time

But this is only if you are displaying intentionally wrong ads

erperejildo commented 6 years ago

This is another app that I've got (an old one): https://play.google.com/store/apps/details?id=drodriguez.apps.Words

It's using this plugin as well and it's also in Designed for Families program. Doesn't have any problem with any kid of banners. The difference here is that that app is using old package versions and no Ionic.

erperejildo commented 6 years ago

@trfife did you find something btw?

trfife commented 6 years ago

@erperejildo After fighting with it for a while I decided to give up on ads and do an in-app-purchase instead to generate revenue since I needed to complete this project by last Sunday. Luckily, with this app I could just turn off a feature till the user makes the purchase. As for the conversation above, I hadn't even got to the play store yet when I hit this error so I hadn't set if my app was for families or not. I was still just testing directly on my device so I don't think that played any part. From looking at the logs it looks like something with the connection is messed up, I was seeing that network error above. I couldn't get the test ads or real ads to show up. I am very interested in a solution though because I have another app in the works that I'd like to put ads on.

devmartinez0 commented 6 years ago

If you are having trouble with this, I recommend to change the package name of your app just for testing (Ex. com.testing54.asdadas). I spend hours and hours trying to fix this problem with the ads and at the end it was nothing related with the plugin or with Ionic/Cordova, the problem was with Google.

If you are using a package name who already exists, and that package name is related to an app who is in the Design For Families program of Google, or is banned from AdMob, you will not see the ads. Even if you are only debugging (trust me, I was only debugging and using test ads and this solved the issue).

Maybe this is not your issue, but you will only spend 5 minutes trying.

Good luck.

erperejildo commented 6 years ago

@trfife I really sorry to hear that. Definitely this needs to be fixed ASAP. We're not talking here about a specific feature, is the main thing: we can't display any ads at all. Did you try at least with the pro one? I'm almost sure that the problem is not related with this plugin anyway. And not even with Ionic. But tbh after all of this time I have no idea...

@cesarmart76 that's interesting. As commented right now I also think that the problem could come from Google. In fact I was doing exactly that: use an existing package name from an app already published and designed for families.

I have no cable to try it right now but if it works... what would happen if I need to use that package name? I want to update my old app which is using Angular 1.2 to the one I've got right now with Ionic and Angular 5.

erperejildo commented 6 years ago

Ok, I ran npm update and tried again and everything is working again!!

erperejildo commented 6 years ago

...but failing again :(

Banner not showing and interstitial just showing the test one (also having isTesting: false)

erperejildo commented 6 years ago

App updated on Google Play and ads not working

erperejildo commented 6 years ago

I've been doing some workaround (again) with this.

With "some changes" I just mean creating variables or something really stupid. It just makes no %$£%$% sense to me.

Might be an issue with the build process but I don't know if this is related with Cordova or Ionic.

I've created also an issue here: https://github.com/ionic-team/ionic/issues/14115

erperejildo commented 6 years ago

Found this link @ratson: https://support.google.com/admob/answer/7562314?ctx=email

Starting January 23, 2018, we will no longer support Google Mobile Ads (GMA) SDK versions lower than 7.0.0 for Android or iOS. To continue serving mobile ads from AdMob, Ad Exchange, or DFP after this date, please upgrade to the latest Google Mobile Ads SDK

rafadeaderinwale commented 6 years ago

I am also facing the same issue. though i am new to app development, I already have an app published with a banner ad that is working. Not sure why i am having this issue now.

uncrabe commented 6 years ago

Same issue here, but only for interstitials.

erperejildo commented 6 years ago

@uncrabe you should have problem with both.

...the more time I spend looking into this the further away I feel to get a solution :S

Om3s commented 6 years ago

I have the same issue, I'm using ionic firebase and ionic native admob-free. Am not able to show interstitials only if I set isTesting = true. The interstitial never gets ready, so it never shows up.

@erperejildo Have you found a solution yet?

erperejildo commented 6 years ago

@Om3s my solution was install admob-pro.

When I tried it before it wasn't working either but only because (I don't know why) I need to install some specific plugins manually (like that one or the status bar). So give it a try

aabdolla commented 6 years ago

@erperejildo Let me know what you think of pro. It has some crazy bad FPS drops while loading a banner ad that make me not want to use it.

erperejildo commented 6 years ago

I load my banner at beginning so I didn't face that (and if I do don't care too much as long it's the main page with the logo)

aabdolla commented 6 years ago

@erperejildo Oh okay. How does it work on iPhone X? That is the only reason I would switch right now as I can't get the banner on the bottom to be above the round corners/safe area.

ChadKoder commented 6 years ago

I only see ads display once on a fresh install of the app, then never again until I delete the app and re-install it. It will then show once, then never again.. Come on someone, fix this! :)

erperejildo commented 6 years ago

@aabdolla I don't know, I haven't tried on that one but you must have to ask these questions on that repo.

Yes @ChadKoder I see similar issue. PRs are welcomed btw.

rlam3 commented 6 years ago
screen shot 2018-04-07 at 10 46 08 am screen shot 2018-04-07 at 11 06 33 am

Is there a reason why we have to delete the app completely from the simulator/emulator on every build?

Whenever I run the following command consecutively without changing any codebase, it shows a black rectangle. No test ad is provided. quasar dev -m cordova -T ios

Would really love to see anybody has any input on this. Thanks!

Shadowstep33 commented 6 years ago

Is there a reason why we have to delete the app completely from the simulator/emulator on every build?

@rlam3 I had a problem like this once, it had to do with the Ionic Pro plugin and it attempting to do a background update. It's probably unrelated, but out of curiosity do you have cordova-plugin-ionic installed?

rlam3 commented 6 years ago

@Shadowstep33 I'm not using any ionic pro plugin. I'm using quasar framework and simply adding admob-free plugin..I'm currently using the interstitial ad and it doesn't show up... on my phone but it shows up in my simulator... don't know why there is a difference here.

erperejildo commented 6 years ago

This has been broken already for more than 5 months and it's the main functionality: display ads.

Do we know at least what the problem here is @ratson? If this is a Google thing can we point to it and open an issue maybe on one of their repos?

SharkyPT commented 6 years ago

I'm also having a similar problem.

On Android:

On iOS

On the stats in AdMob the iOS Banner shows 0 impressions but several requests meaning that the requests are reaching adMob.

erperejildo commented 6 years ago

that sounds like a different issue. Open a new ticket

erperejildo commented 6 years ago

Well I gave it another workaround and this what I did:

async showBannerFree() {
   // this is called by default but you can call it again to refresh the ad 
    try {
      this.admobFree.banner.show()
        .then(() => {
        })
        .catch(e => console.log(e));
    }
    catch (e) {
      console.error(e);
    }
  }

  async showInterstitialFree() {
   // this doesn't work if you want to open it straight away when phone loads but I don't need that
    try {
      if (this.platform.is('cordova')) {
        this.admobFree.interstitial.show();
      }
    }
    catch (e) {
      console.error(e);
    }
  }

Tested locally and on prod.

Hope this helps to everybody!

owen-m1 commented 5 years ago

What is a provider constructor?