大佬教程收集整理的这篇文章主要介绍了cordova – 每2分钟通过Adonic在Ionic中显示插页式广告,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
function initAd(){ // it will display smart bAnner at top center,using the default options if(AdMob) AdMob.createBAnner( { adId: admobid.bAnner,bAnnerId: admobid.bAnner,position: AdMob.AD_POSITION.bOTTOM_CENTER,autoShow: true,isTesTing: false,success: function() { console.log('bAnner created'); },error: function() { console.log('Failed to create bAnner'); } }); window.AdMob.prepareInterstitial({ adId:admobid.interstitial,autoShow:false }); window.AdMob.showInterstitial(); }
有没有办法每2分钟显示一个部分广告?有人告诉我添加这个:seTinterval(showInterstitial,1 * 60 * 1000),但我不知道在哪里添加?
seTinterval(window.AdMob.showInterstitial,2*60*1000);
function initAd(){ // it will display smart bAnner at top center,using the default options if(AdMob) AdMob.createBAnner( { adId: admobid.bAnner,position:AdMob.AD_POSITION.bOTTOM_CENTER,success: function(){ console.log('bAnner created'); },error: function(){ console.log('Failed to create bAnner'); } } ); window.AdMob.prepareInterstitial( {adId:admobid.interstitial,autoShow:falsE} ); window.AdMob.showInterstitial(); //!!!add the code here!!! - so,just paste what I wrote above: seTinterval(window.AdMob.showInterstitial,2*60*1000); }
您可以在此jsFiddle example上看到一个简单的seTinterval用法:
function a(){ alert("hi every 2 seconds"); }; seTinterval(a,2*1000);
你之所以不应该这样称呼它(注意a之后的括号):seTinterval(a(),2 * 1000);那么你的函数只会被调用一次(你会看到只弹出一个警告). jsFiddle的例子:
function a(){ alert("hi every 2 seconds"); }; seTinterval(a(),2*1000);
希望这有助于清除一些事情.
以上是大佬教程为你收集整理的cordova – 每2分钟通过Adonic在Ionic中显示插页式广告全部内容,希望文章能够帮你解决cordova – 每2分钟通过Adonic在Ionic中显示插页式广告所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。