我正在使用Windows,php风暴,我无法添加以下插件。 admob plugin for cordova。任何人帮助我,我是剑道ui手机的新手
第1步:在AdMob门户网站中为您的横幅广告和插页式广告创建广告单元ID,然后将其写入您的javascript代码中。
// select the right Ad Id according to platform
var admobid = {};
if( /(android)/i.test(navigator.userAgent) ) { // for android
admobid = {
banner: 'ca-app-pub-xxx/xxx', // or DFP format "/6253334/dfp_example_ad"
interstitial: 'ca-app-pub-xxx/yyy'
};
} else if(/(ipod|iphone|ipad)/i.test(navigator.userAgent)) { // for ios
admobid = {
banner: 'ca-app-pub-xxx/zzz', // or DFP format "/6253334/dfp_example_ad"
interstitial: 'ca-app-pub-xxx/kkk'
};
} else { // for windows phone
admobid = {
banner: 'ca-app-pub-xxx/zzz', // or DFP format "/6253334/dfp_example_ad"
interstitial: 'ca-app-pub-xxx/kkk'
};
}
第2步:想要横幅?单行的javascript代码。
// it will display smart banner at top center, using the default options
if(AdMob) AdMob.createBanner( {
adId: admobid.banner,
position: AdMob.AD_POSITION.TOP_CENTER,
autoShow: true } );
第3步:想要全屏广告?简单,2行代码。
// preppare and load ad resource in background, e.g. at begining of game level
if(AdMob) AdMob.prepareInterstitial( {adId:admobid.interstitial, autoShow:false} );
// show the interstitial later, e.g. at end of game level
if(AdMob) AdMob.showInterstitial();