Search code examples
cordovaadmobphonegap-pluginscordova-3icenium

Getting Blank Black adMob ad in Cordova using Admob Plugin


I am using this admob cordova plugin. I've installed the plugin in Icenium and put the javascript code in the body:

document.addEventListener('deviceready', function () {
if (window.plugins && window.plugins.AdMob) {
    var admob_ios_key = 'xxxxxxxxxxxxxxx';
    var admob_android_key = 'xxxxxxxxxxxxxxx';
    var adId = (navigator.userAgent.indexOf('Android') >= 0) ? admob_android_key : admob_ios_key;
    var am = window.plugins.AdMob;

    am.createBannerView(
        {
            'publisherId': adId,
            'adSize': am.AD_SIZE.BANNER,
            'bannerAtTop': false
        },
         function () {
              am.requestAd(
                { 'isTesting': true },
                    function () {
                        am.showAd(true);
                    },
                    function () { alert('failed to request ad'); }
                );
            },
            function () { alert('failed to create banner view'); }
        );
} else {
    alert('AdMob plugin not available/ready.');
}

});

My problem is that I don't see the ad, but just a black rectangle placeholder at the bottom of the screen.

I wanted to know why it doesn't show the ad, and if that's have to do with the asmob_ios_key and admob_android_key, I want to know what to put there. I put my admob publisher id number (without the 'pub-'), but I am not sure that this what I should put in the field


Solution

  • I know this is old but i have just installed this on xcode, using cordova 3.3.0. I used my publisher id. began with an 'a'. I did have it in wrong and i got a blank black screen at the bottom, actually had some spaces between the '' marks