I am trying from last 7 days to run Google AdMob in Ionic 3 application. Steps I followed as shown here
By using below code, the ads is not displaying! I have followed this tutorial.
Current issue: No ads displaying and Not getting any error!
In component code
....
....
constructor(public storage: Storage, public navCtrl: NavController, private platform: Platform,public admob:AdmobFreeService) {
this.platform.ready().then(val => {
this.admob.BannerAd();
});
In service
import { Injectable } from "@angular/core";
import {
AdMobFree,
AdMobFreeBannerConfig,
AdMobFreeInterstitialConfig,
AdMobFreeRewardVideoConfig
} from '@ionic-native/admob-free/ngx';
import { Platform } from 'ionic-angular';
@Injectable()
export class AdmobFreeService {
constructor(
private admobFree: AdMobFree,
public platform: Platform
) {
}
BannerAd() {
let bannerConfig: AdMobFreeBannerConfig = {
autoShow: true,
id: "ca-app-pub-4622639730805786/6571035695"
};
this.admobFree.banner.config(bannerConfig);
this.admobFree.banner.prepare().then(() => {
// success
this.admobFree.banner.show();
}).catch(e => alert(e));
}
}