I am trying to implement a CustomEventBanner adapter for Amazon banner ads.
Everything is pretty straightforward except for one thing. Sometimes they open what I think is a PopupWindow instead of an Activity when the user clicks on an ad. The problem is that the user might still be interacting with this popup when the mediation layer decides it is time to refresh the ad. So the adapter's requestBannerAd() gets called again while the popup is still visible.
They have some recommendations for this, see here:
https://developer.amazon.com/public/apis/earn/mobile-ads/docs/with-other-sdks (bottom of page, Mediator SDK Integration).
Their first recommendation is to use a boolean variable to remember if a popup is currently shown. I have two problems with that. First it would have to be a static variable since a new CustomEventBanner seems to be created on every ad refresh. But what should happen if the device orientation changes? How could the adapter detect that? And second, assuming the boolean variable does what it is supposed to do, what should the adapter do if the popup is indeed visible? Call listener.onFailedToReceiveAd()? Does not work, the mediation layer would look for the next ad network. listener.onReceivedAd(View)? Does not seem to work either, popup gets destroyed. Do nothing at all? Does not seem to be appropriate either.
TLDR: Has anyone successfully implemented a CustomEventBanner for Amazon that adheres to Amazon's recommendations and is willing to share the code or ideas?