2016-01-13 56 views
0

我一直在試圖爲新的離子2個應用程序添加的橫幅廣告,但這些廣告都沒有顯示出來 我這樣做如下所示添加橫幅廣告與離子2個應用

http://pointdeveloper.com/ionic-2-banner-ads-with-admob-pro-plugin/

這裏我app.js文件中的代碼

import {App, Platform, Config} from 'ionic/ionic'; 
import {TabsPage} from './pages/tabs/tabs'; 


@App({ 
    templateUrl: 'build/app.html', 
    // Check out the config API docs for more info 
    // http://ionicframework.com/docs/v2/api/config/Config/ 
    config: { 
    tabbarPlacement: 'bottom' 
    } 
}) 
export class MyApp { 
    constructor(platform: Platform) { 
    this.root = TabsPage; 

    platform.ready().then(() => { 
     // Do any necessary cordova or native calls here now that the platform is ready 
     var admobid = {}; 
     // select the right Ad Id according to platform 
     if(/(android)/i.test(navigator.userAgent)) { 
      admobid = { // for Android 
       banner: 'ca-app-pub-6869992474017983/9375997553', 
       interstitial: 'ca-app-pub-6869992474017983/1657046752' 
      }; 
     } 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' 
      }; 
     } 

    if(window.AdMob) AdMob.createBanner({ 
     adId:admobid.banner, 
     isTesting:true, 
     position:AdMob.AD_POSITION.BOTTOM_CENTER 
    }); 
    }); 
    } 
} 

回答

3

嘿我看見你正在使用我的文章在這裏

http://pointdeveloper.com/ionic-2-banner-ads-with-admob-pro-plugin/

,但你需要做的是添加車展:真

所以在你的代碼必須滿足下列條件

if(window.AdMob) AdMob.createBanner({ 
     adId:admobid.banner, 
     isTesting:true, 
     position:AdMob.AD_POSITION.BOTTOM_CENTER, 
     autoShow:true //this shows the ad 
     }); 
0

我也有一個問題,旗幟作品,但間質性崩潰我的應用程序,我不知道爲什麼..

我必須把東西放在我的網頁?像參數或進口?

+0

遵循本教程http://pointdeveloper.com/ionic-2-banner-ads-with-admob-pro-plugin/並且它的工作無需添加任何參數 – krv

+0

但是對於我來說,插頁式應用程序崩潰的應用程序.. 。 – zozourban