Admob - 横幅显示黑色背景且没有广告

Admob - The banner shows a black background and no ad(Admob - 横幅显示黑色背景且没有广告)
本文介绍了Admob - 横幅显示黑色背景且没有广告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Ionic Framework,还有这个插件:

I'm using Ionic Framework, and this plugin:

https://github.com/floatinghotpot/cordova-plugin-admob

当我将应用部署到安卓手机时,我看到一个黑色矩形,但没有广告.

When I deployed the app to the android phone, I see a black rectangle, but no ad.

我真的不知道发生了什么......这是我的代码:

I don't really know what's happening.. This is my code:

$ionicPlatform.ready(function() {

$ionicPlatform.ready(function() {

     //Admob
    var am = window.plugins.AdMob;
    am.createBannerView(
      {
        'publisherId': 'xxxxxxxxxx',
        'adSize': am.AD_SIZE.SMART_BANNER,
        'bannerAtTop': false
      },
      function() {
        am.requestAd(
          {
            'isTesting': true
          },
          function() {
            am.showAd(true);
          },
          function() {
            /* Handle error */
          }
        );
      },
      function() {
        /* Handle error */
      }
    );       
});

当您安装之前的 admob 插件时,也会安装 Google play services 插件.如果有人可以帮助我,我将不胜感激.提前致谢

Google play services plugin is also installed when you installed the previous admob plugin. If anyone can help me, I would really appreciate it. Thanks in advance

推荐答案

我注意到您将 isTesting 设置为 true.如果您使用的是 Android 模拟器,则在此模式下可能无法呈现广告.

I noticed that you set isTesting to true. If you are using the Android simulator it may not render ads when you are in this mode.

还要确保您实际上使用了正确的发布者 ID.我知道它有时会让人感到困惑,因为 Admob 提供了一些可供选择的可能性.

Also make sure that you are in fact using the correct publisher id. I know it can sometimes be confusing since Admob gives a few possibilities to choose from.

我在我的博客上发表了一篇关于如何让 Admob 与 IonicFramework 一起工作的文章.可以在这里找到:

I made a post on how to get Admob working with IonicFramework on my blog. It can be found here:

https://www.thepolyglotdeveloper.com/2014/06/using-admob-ionicframework/

如果这仍然不起作用,请告诉我们,我们可以从那里进行故障排除.

If that still doesn't work, let us know and we can troubleshoot from there.

干杯,

这篇关于Admob - 横幅显示黑色背景且没有广告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

How to target newer versions in .gitlab-ci.yml using auto devops (java 11 instead of 8 and Android 31 instead of 29)(如何在.gitlab-ci.yml中使用自动开发工具(Java 11而不是8,Android 31而不是29)瞄准较新的版本)
Android + coreLibraryDesugaring: which Java 11 APIs can I expect to work?(Android+core LibraryDesugering:我可以期待哪些Java 11API能够工作?)
How to render something in an if statement React Native(如何在If语句中呈现某些内容Reaction Native)
How can I sync two flatList scroll position in react native(如何在本机Reaction中同步两个平面列表滚动位置)
Using Firebase Firestore in offline only mode(在仅脱机模式下使用Firebase FiRestore)
Crash on Google Play Pre-Launch Report: java.lang.NoSuchMethodError(Google Play发布前崩溃报告:java.lang.NoSuchMethodError)