i try to reload Rewarded Video Ads, when i call RewardedVideoAd.instance.load(adUnitId: \"xxx\", targetingInfo: xyz);
i find below error :
Hi I think the best solution is using try catch and if there is a problem we can try to show it again. Here is my code;
MobileAdTargetingInfo targetingInfo = MobileAdTargetingInfo(
keywords: ['flutterio', 'beautiful apps'],
contentUrl: 'https://flutter.io',
childDirected: false,
testDevices: [],
);
String adUnit = "ca-app-pub-6288831324909345/9733176442";
bool tryAgain = false;
await RewardedVideoAd.instance
.load(adUnitId: adUnit, targetingInfo: targetingInfo);
try {
await RewardedVideoAd.instance.show();
} on PlatformException catch (e) {
tryAgain = true;
print(e.message);
}
RewardedVideoAd.instance.listener =
(RewardedVideoAdEvent event, {String rewardType, int rewardAmount}) {
switch (event) {
case RewardedVideoAdEvent.rewarded:
setState(() {
// Here, apps should update state to reflect the reward.
print("_goldCoins += rewardAmount");
});
break;
case RewardedVideoAdEvent.loaded:
if (tryAgain) RewardedVideoAd.instance.show();
break;
default:
print(event.toString());
break;
}
};