admob-google / admob-cordova

Google AdMob plugin for Cordova, Phonegap and Intel XDK ,support ios and android,support admob v1 and admob v2 ,Monetize your html5 app with one javascript line.api is easy to use.
65 stars 50 forks source link

ads not showing up #14

Closed gregstein closed 8 years ago

gregstein commented 8 years ago

Hi again,

ads do not display unless I visit a website from the app and then go back , only then the ads start showing up. Any idea why ?

Thank you,

gregstein commented 8 years ago

by the way is this javascript code that should be used ?:

var bannerAdUnit = "ca-app-pub-4906074177432504/9172302471";
var fullScreenAdUnit = "ca-app-pub-4906074177432504/7555968477";
var isOverlap = true; //true: overlap, false: split
var isTest = false;
/*
 var bannerAdUnit;
 var fullScreenAdUnit;
 var isOverlap = true; //true: overlap, false: split
 var isTest = true;
 //android
 if (navigator.userAgent.match(/Android/i)) {
    bannerAdUnit = "ca-app-pub-4906074177432504/9172302471";
    fullScreenAdUnit = "ca-app-pub-4906074177432504/1649035673";
 }
 //ios
 else if (navigator.userAgent.match(/iPhone/i) || navigator.userAgent.match(/iPad/i)) {
    bannerAdUnit = "ca-app-pub-4906074177432504/4602502071";
    fullScreenAdUnit = "ca-app-pub-4906074177432504/7555968477";
 }
 //wp8
 else if( navigator.userAgent.match(/Windows Phone/i) ) {
    bannerAdUnit = "ca-app-pub-4906074177432504/4462901274";
    fullScreenAdUnit = "ca-app-pub-4906074177432504/5939634477";
 }
*/
document.addEventListener("deviceready", function(){
    window.admob.setUp(bannerAdUnit, fullScreenAdUnit, isOverlap, isTest);

    //banner ad callback
    window.admob.showBannerAd('bottom-center', 'SMART_BANNER');

}, false);

/*
position: 'top-left', 'top-center', 'top-right', 'left', 'center', 'right', 'bottom-left', 'bottom-center', 'bottom-right'
size:   'BANNER' (320x50, Phones and Tablets)
        'LARGE_BANNER' (320x100, Phones and Tablets)
        'MEDIUM_RECTANGLE' (300x250, Phones and Tablets)
        'FULL_BANNER' (468x60, Tablets)
        'LEADERBOARD' (728x90, Tablets)
        'SKYSCRAPER' (120x600, Tablets, ipad only)
        'SMART_BANNER' (Auto size, Phones and Tablets, recommended)
*/
gregstein commented 8 years ago

Please anyone ?

gregstein commented 8 years ago

oh snap!! I was using wrong code.

Thank you <3