I'm having a problem after configured the Interstitial with Admob Free plugin
First, I was able to display the Interstitial with the following config
let interConfig: AdMobFreeInterstitialConfig = {
isTesting: false,
autoShow: true,
id: this.adconfig.idIntersticial,
};
this.admob.interstitial.config(interConfig);
this.admob.interstitial
.prepare()
.then(() => {
console.log('insterstitial displayed');
})
.catch((e) => console.log(e));
I'm calling this code twice in my Home.ts, and for each call I setup a listener to execute a specific action when the user closes the interstitial
this.admob.on(this.admob.events.INTERSTITIAL_CLOSE).subscribe(() => {
this.function1();
});
and in another method
this.admob.on(this.admob.events.INTERSTITIAL_CLOSE).subscribe(() => {
this.function2();
});
My problem is... the first time I close the interstitial everything works nicely, let's say I closed and the this.function1()
method was called for the first scenario, but from the second call on the listeners are appended to the INTERSTITIAL_CLOSE, for example, if I execute the second scenario to close and execute this.function2()
the this.function1()
is called again after executing this.function2()
.
What am I doing wrong? And how can I reset the listeners?