Admob ads not display

#1

Admob ads, not display

I have created a new application and added below add code but ads not display I have done a small change in id= ‘ca-app-pub-9304661536848605/4466219588’ to id: ‘ca-app-pub-9304661536848605/4466219588’ because build time getting error.

app.module.ts

import { AdMobFree } from '@ionic-native/admob-free';

providers: [
    StatusBar,
    SplashScreen,
    AdMobFree,
    {provide: ErrorHandler, useClass: IonicErrorHandler}
  ]

Homepage code I have 8 pages but added coded the only homepage because of testing.

import { AdMobFree , AdMobFreeBannerConfig } from '@ionic-native/admob-free';

export class HomePage {

  constructor(public navCtrl: NavController, private admobFree: AdMobFree) {
  	this.loadBanner();
  }

  loadBanner(){

  	const addConfig: AdMobFreeBannerConfig = {
	 id: 'ca-app-pub-9304661536848605/4466219588',
	 isTesting: false,
	 autoShow: true
	};
	this.admobFree.banner.config(addConfig);

	this.admobFree.banner.prepare()
	  .then(() => {
	    console.log("Banner Is desplayed");
	  })
	  .catch(e => console.log(e));
  }
}
#2
.then(()=>{
        this.admob.banner.show();
})
#4

Where should I add this code?

#5

HomePage.ts

...
loadBanner(){
...
this.admobFree.banner.prepare()
	  .then(() => {
	    this.admob.banner.show();
	  })
	  .catch(e => console.log(e))
}

and if this doesn’t work , add error here

#6

Getting this error when I run build commond

            Property 'admob' does not exist on type 'HomePage'.

      L29:  .then(() => {
      L30:      this.admob.banner.show();
      L31:    console.log("Banner Is desplayed");
#7

HomePage.ts

import { Component } from '@angular/core';
import { NavController,Platform } from 'ionic-angular';

import { AdMobFree, AdMobFreeRewardVideoConfig , AdMobFreeBannerConfig, AdMobFreeInterstitialConfig }  from '@ionic-native/admob-free';

@Component({
  selector: 'page-home',
  templateUrl: 'home.html'
})
export class HomePage {

  constructor(public navCtrl: NavController,
              private admob: AdMobFree,
              private platform: Platform
                ) 
            showBanner();
 }
  showBanner() {
    if(this.platform.is('cordova')){
		const bannerConfig: AdMobFreeBannerConfig = {
			id: 'your ad id',
			isTesting: false,
			autoShow: true,
                };

  		this.admob.banner.config(bannerConfig);

		this.admob.banner.prepare()
                .then(()=>{
                       this.admob.banner.show();
                  })
               .catch(e => console.log(e));
}
}

this is my code and it is working on phone . But it did not work on browser as i remember . i exported apk and uploaded to my phone then it worked

#8

sorry my fault .

.then(() => {
	    this.admobFree.banner.show();
	  })
#9

Right now showing just dark gray color strip but no ads.

#10

did you try it on phone?

#11

yes i try on my both phone same gray strip come