Repository navigation
Description
Describe the bug
RewardedAdUnit grants the reward on every close, even when the controller is a third-party plugin renderer that decided the user did not earn it. The controller listener in BaseInterstitialAdUnit calls notifyUserReward() from onInterstitialClosed() (3.4.0: BaseInterstitialAdUnit.java:413-416; 3.3.1: :337-340; the same in 3.3.2, 3.3.4 and master). The only guard is userHasNotEarnedRewardYet, so the first close after each load always fires RewardedAdUnitListener.onUserEarnedReward.
For Prebid's own renderer this looks deliberate: InterstitialController.onAdClosed also grants the reward on close when the user was not rewarded yet (InterstitialController.java:101-105). A third-party plugin (PrebidMobilePluginRenderer, other than the built-in PrebidRenderer) owns its own reward rules and reports the reward through InterstitialControllerListener.onUserEarnedReward(). The close fallback overrides that decision, so a user who closes a plugin-rendered rewarded ad early still gets the reward.
To Reproduce
- Register a plugin renderer whose
isSupportRenderingForreturns true for rewarded, and whosecreateInterstitialControllerreturns a controller that callsonInterstitialDisplayed()and thenonInterstitialClosed(), and never callsonUserEarnedReward(). - Load a
RewardedAdUnitwith a bid routed to that plugin (ext.prebid.meta.rendererNameandrendererVersionmatch), then callshow(). On 3.4.0, do not calldestroy()insideonAdClosed, because that clears the listener first. - Close the ad.
RewardedAdUnitListener.onUserEarnedRewardfires right afteronAdClosed, although the controller never calledonUserEarnedReward().
We hit this with the Chartboost plugin renderer. When the bid sets a reward duration and the user closes before it, the Chartboost SDK does not call its reward callback, so the plugin never calls onUserEarnedReward(). The publisher still gets Prebid's reward callback.
Expected behavior
For a third-party plugin controller, only onUserEarnedReward() grants the reward. Closing the ad does not.
Possible fix
Let a plugin declare that it reports rewards itself, for example with a default method on PrebidMobileInterstitialControllerInterface that returns false. The default keeps today's behavior for existing plugins and for PrebidRenderer. When it returns true, onInterstitialClosed() does not call notifyUserReward().
Smartphone
- Prebid Mobile SDK: 3.3.1 and 3.4.0 (the same code in 3.3.2, 3.3.4 and master)
- Device: Android emulator, Android 16 (API 36)
Related: #1004
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
Grant rewards only when the controller reports them (#1026) (#1029)