solimanware
solimanware

Reputation: 3051

Adding admob ads to phonegap app

I am now using Phonegap build

I am a beginner with JavaScript

Now I gone along with this

https://github.com/floatinghotpot/cordova-admob-pro/wiki/00.-How-To-Use-with-PhoneGap-Build

My config.xml contains

<gap:plugin name="com.google.cordova.admob" source="plugins.cordova.io" />

and my index.html contain these JS and HTML

var admobid = {};
if( /(android)/i.test(navigator.userAgent) ) { 
    admobid = { // for Android
        banner: 'ca-app-pub-5064752282990502/4341809673',
        interstitial: 'ca-app-pub-5064752282990502/5818542873'
    };
} else if(/(ipod|iphone|ipad)/i.test(navigator.userAgent)) {
    admobid = { // for iOS
        banner: 'ca-app-pub-6869992474017983/4806197152',
        interstitial: 'ca-app-pub-6869992474017983/7563979554'
    };
} else {
    admobid = { // for Windows Phone
        banner: 'ca-app-pub-6869992474017983/8878394753',
        interstitial: 'ca-app-pub-6869992474017983/1355127956'
    };
}

function initApp() {
    if (AdMob) {
        AdMob.createBanner({
            adId : admobid.banner,
            position : AdMob.AD_POSITION.BOTTOM_CENTER,
            autoShow : true
        });
    }
}

document.addEventListener('deviceready', initApp, false);
<body onload="initApp()">
  
  bla bla bla bla
<body>

Where the Error and How I can display the ads at the bottom of the page ??

Upvotes: 1

Views: 1147

Answers (2)

solimanware
solimanware

Reputation: 3051

I have created this project for every one who need to use admob inside his app https://github.com/Microsmsm/Admob-starter

Upvotes: 0

Subjective Effect
Subjective Effect

Reputation: 1465

First, run some console logs on the variables to see if they exist. You can use Chrome inspect to see the console if you plug your phone in.

Second, make sure it's at least 24 hours since you set the Admob instance up at Google. I always find nothing works for at least 24 hours and then bang - it's working.

Upvotes: 0

Related Questions