Needs your guidance on this exception

41 views
Skip to first unread message

Jonathan Bellfontaine

unread,
Apr 23, 2024, 1:13:34 PMApr 23
to Google Mobile Ads SDK Developers

When navigating through different screens, I am calling..

RewardedAdinstance.dispose();  -- to clear any loaded ads 

However, after several times, precache error exception thrown and ads don't load.
Even if I trigger another call, it keeps throwing the same error. 

Can you please give me when this exception thrown and what can be done to prevent this??

Screen Shot 2024-04-23 at 1.10.43 PM.png

Mobile Ads SDK Forum Advisor

unread,
Apr 24, 2024, 2:44:20 AMApr 24
to jonathan.b...@gmail.com, google-adm...@googlegroups.com

Hi Jonathan,

Thank you for contacting the Mobile Ads SDK Support team.

You can close a Rewarded Ad after a user has earned a reward, you can use the following code:

rewardedAd.onUserEarnedReward.listen((reward) {
  // Close the ad.
 rewardedAd.dispose();
});

The rewardedAd.show() method will show the Rewarded Ad. The rewardedAd.onUserEarnedReward event will be fired when the user earns a reward. The reward object will contain information about the reward that the user has earned. The rewardedAd.dispose() method will close the Rewarded Ad.

Here is an example of how to use this code:

import 'package:google_mobile_ads/google_mobile_ads.dart';

void main() {
  // Initialize the Mobile Ads SDK.
  MobileAds.initialize();
  // Create a RewardedAd object.
  RewardedAd rewardedAd = RewardedAd(
    adUnitId: 'ca-app-pub-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
  );

  // Load the RewardedAd.
  rewardedAd.loadAd();
  // Listen for the RewardedAd event.
  rewardedAd.onUserEarnedReward.listen((reward) {
    // Close the ad.
    rewardedAd.dispose();
  });
}

Kindly refer to the Rewarded implementation documentation for more details about it. Also, can you confirm whether the precache error exception is reproducible in our Google sample apps? If yes, kindly provide the below information to investigate and reproduce the precache error on our end.

  • Steps to replicate the issue
  • Minimal sample project reproducing the issue
This message is in relation to case "ref:!00D1U01174p.!5004Q02tPI1c:ref" (ADR-00232331)

Thanks,
 
Google Logo Mobile Ads SDK Team


Reply all
Reply to author
Forward
0 new messages