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

Interstitial doesn't show up #19

Closed gregstein closed 8 years ago

gregstein commented 8 years ago

Hello,

You have earlier provided me with the interstitial code. I have added to my banner code, but only the banner works. Here is the code:

function onInterstitialReceive (message) {
admob.showInterstitial();//show when load success
}
function onReceiveFail (message) {
    var msg=admob.Error[message.data];
    if(msg==undefined){
       msg=message.data;
    }
admob.cacheInterstitial();//load again when load fail
   alert("load fail: "+message.type+"  "+msg);
}
function onDeviceReady() {
    admob.initAdmob("ca-app-pub-xxxxxxx","ca-app-pub-xxxxx");//init admob 
    document.addEventListener(admob.Event.onInterstitialReceive, onInterstitialReceive, false);
    document.addEventListener(admob.Event.onInterstitialFailedReceive,onReceiveFail, false);
admob.cacheInterstitial();// start load 
    admob.showInterstitial();
}
document.addEventListener('deviceready',onDeviceReady, false);       

    function onDeviceReady() {
        admob.initAdmob("ca-app-pub-xxxxxx","ca-app-pub-xxxxxx");
        admob.showBanner(admob.BannerSize.BANNER,admob.Position.BOTTOM_APP);//show banner at the top of app 
    }
    document.addEventListener('deviceready',onDeviceReady, false);
admob-google commented 8 years ago

where is the code?

gregstein commented 8 years ago

Code updated

admob-google commented 8 years ago

any error or log? is onReceiveFail called?

gregstein commented 8 years ago

Thank you ! That was it <3