Admob - the banner shows a black background and without ads

I am using the Ionic Framework and this plugin:

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

When I deployed the application on an Android phone, I see a black rectangle, but not an ad.

I do not know what is happening ... This is my code:

$ 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 */
      }
    );       
});

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

+4
source share
2 answers

, isTesting true. Android-, , .

, . , , Admob .

, Admob IonicFramework . :

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

, .

,

+4

3 :

1) adunit admob, .

2) , cordova.js.

<script type="text/javascript" src="./cordova.js"></script>

3) , .

call cordova plugin add https://github.com/fedmich/cordova-plugin-admob.git

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

0

Source: https://habr.com/ru/post/1542597/


All Articles