Rewarded
Integration
Below we show a simple example to understand how rewarded ads work:
import 'package:wortise/rewarded_ad.dart';
RewardedAd _rewardedAd;
// Create an interstitial
_rewardedAd = RewardedAd('Wortise Ad Unit ID', (event, args) {
// This listener will be invoked when an event happens
});
// Request an ad
await _rewardedAd.loadAd();
/* ... */
// Show the ad if available
if (await _rewardedAd.isAvailable) {
await _rewardedAd.showAd();
}The RewardedAd class constructor admits a third parameter, called reloadOnDismissed, that when it is set to true (the default value is false) allows the rewarded to automatically load a new ad when the current one is dismissed.
Listener events
The assigned listener to an RewardedAd can receive the following events:
Below, we show a small example about how to obtain the reward once the ad has completed successfully:
Última actualización