admob unsubscribe from listeners error

When setting event listeners like so:

AdMobRewarded.addEventListener('rewardedVideoDidRewardUser', () => console.log('rewarded'));
AdMobRewarded.addEventListener('rewardedVideoDidLoad', () => console.log('videoloaded'));
AdMobRewarded.addEventListener('rewardedVideoDidFailToLoad', () => console.log('failedtoload'));
AdMobRewarded.addEventListener('rewardedVideoDidOpen', () => console.log('opened'));
AdMobRewarded.addEventListener('rewardedVideoDidClose', () => console.log('didclose'));
AdMobRewarded.addEventListener('rewardedVideoWillLeaveApplication', () => console.log('leaveapp'));

and then unsubscribing from them like so:


You get hit with an error:
Attempted to remove more ‘ExpoAdMobRewardedVideoAdManager’ listeners than added

Any idea why this is happening?

Figured it out. The docs are missing that there is another event listener: rewardedVideoDidStart

When you add that listener, you can then call removeAllListeners() and it will work as intended.

Hey @ac1,

Glad you figured it out and thanks for catching the problem with our docs. Was about to ask if you mind creating a PR for this but it appears you already did! I left a comment for you on your PR.


This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.