Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A bug in java example RewardedVideoExample in rewarded ad load condition #775

Open
hannayurkevich opened this issue Dec 3, 2024 · 2 comments · May be fixed by #789
Open

A bug in java example RewardedVideoExample in rewarded ad load condition #775

hannayurkevich opened this issue Dec 3, 2024 · 2 comments · May be fixed by #789

Comments

@hannayurkevich
Copy link

Hi guys,

I'm investigating the code for rewarded ads load in RewardedVideoExample and I can't get the idea of line 105:

if (rewardedAd != null && !isLoading && googleMobileAdsConsentManager.canRequestAds()) {
  loadRewardedAd();
}

And rewardedAd != null check doesn't make sense to me considering that loadRewardedAd() method then checks it for null:

private void loadRewardedAd() {
    if (rewardedAd == null) {
        // load logic here
    }
}

But I suppose this check was added for some reason and I would really appreciate it if someone explain it.

Thanks!

@hannayurkevich
Copy link
Author

Hm, in your kotlin example in the same line the condition is the following:

  if (rewardedAd == null && !isLoading && googleMobileAdsConsentManager.canRequestAds) {
    loadRewardedAd()
  }
  • it checks rewardedAd == null which looks more correct to me.

So it looks like a bug in java example, please fix it.

Thanks.

@hannayurkevich hannayurkevich changed the title A question about rewarded ad load A bug in java example RewardedVideoExample in rewarded ad load condition Dec 4, 2024
@malandr2
Copy link
Contributor

Hi @hannayurkevich, thanks for flagging. We have a PR out #789 to address this issue.

@malandr2 malandr2 linked a pull request Jan 16, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants