Hello guys im using the Admobpro cordova Plugin for Admob Ads.
I have the Problem that in one Page i want to show the Banner ad and show it only on that specific page and hide it if the user navigate to another page.
My Problem here is that the Banner is showing correctly but if the user navigate to another page the banner stays at the bottom and doesnt hide.
This is what i have now in my Acitivity.ts:
declare var AdMob: any;
@Component({
selector: 'page-Hot',
templateUrl: 'Hot.html'
})
export class Hot {
private admobId: any;
constructor(public navCtrl: NavController, private platform: Platform)
{
this.platform = platform;
if(/(android)/i.test(navigator.userAgent)) {
this.admobId = {
banner: 'ca-app-pub-3164064775083881/8630208453',
};
} else if(/(ipod|iphone|ipad)/i.test(navigator.userAgent)) {
this.admobId = {
banner: 'ca-app-pub-3164064775083881/2583674858',
};
}
this.createBanner();
}
createBanner() {
this.platform.ready().then(() => {
if(AdMob) {
AdMob.createBanner({
adId: this.admobId.banner,
autoShow: false
});
}
});
this.showBanner("bottom");
}
showBanner(position) {
this.platform.ready().then(() => {
if(AdMob) {
var positionMap = {
"bottom": AdMob.AD_POSITION.BOTTOM_CENTER,
"top": AdMob.AD_POSITION.TOP_CENTER
};
AdMob.showBanner(positionMap[position.toLowerCase()]);
}
});
}