showRewardedAd static method
Future<void>
showRewardedAd({})
Show a rewarded Ad.
adUnitId
- The ID of the rewarded ad unit.onStart
- called on when an ad has started playback.onClick
- called on when an ad has been clicked by the user.onRewarded
- called on when an ad should reward the user.onClosed
- called on when an ad has closed after playback has completed.onFailed
- called on when an ad has a failure during playback. Server-to-server redeem callbacks: https://docs.unity.com/mediation/S2SRedeemCallbacks.htmluserId
- The publisher's user id. This will be passed along in the S2S reward callback feature to the publisher's S2S server.customizedData
- The publisher's custom data in whatever string format they wish (ex. JSON). This can be any data that the publisher wants forwarded to their S2S server.
Implementation
static Future<void> showRewardedAd({
required String adUnitId,
Function(String adUnitId)? onStart,
Function(String adUnitId)? onClick,
Function(String adUnitId, UnityMediationReward reward)? onRewarded,
Function(String adUnitId)? onClosed,
Function(String adUnitId, ShowError error, String errorMessage)? onFailed,
String? userId,
String? customizedData,
}) async {
await _showAd(
methodName: showRewardedAdMethod,
adUnitId: adUnitId,
onStart: onStart,
onClick: onClick,
onClosed: onClosed,
onFailed: onFailed,
onRewarded: onRewarded,
userId: userId,
customizedData: customizedData,
);
}