This error i am getting when try to add admob in my ionic APP
ERROR Error: Uncaught (in promise): TypeError: Cannot read property ‘BannerAd’ of undefined
TypeError: Cannot read property ‘BannerAd’ of undefined
Currently, i am using admob-plus
From Installation | AdMob Plus
My Code
Package.json
“cordova”: {
"plugins": {
"admob-plus-cordova": {
"APP_ID_ANDROID": "ca-app-pub-9811029622947793/5972533670",
"APP_ID_IOS": "ca-app-pub-2188012581174186/3478090400"
}
}
}
APP.module.ts
import { AdMob } from ‘@admob-plus/ionic/ngx’;
providers: [ AdMob,]
Home.ts
import { AdMob } from ‘@admob-plus/ionic/ngx’;
import { Platform } from ‘@ionic/angular’;
constructor(private platform: Platform,private route: ActivatedRoute,private admob: AdMob,
// private admobFreeService: AdmobfreeService,
) {
this.platform.ready().then(async () => {
const banner = new this.admob.BannerAd({
adUnitId: 'ca-app-pub-9811029622947793/7232826218',
});
await banner.show();
this.admob.on('admob.banner.impression').subscribe(async () => {
await banner.hide();
});
});
}
Currently i am using ionic 6
Please Help me
1 post - 1 participant