showRewardedVideoAd method
Shows the ad requested using the responseId
After calling the Ad it will open and call onOpened
,
then starts playing (if completed and not skipped, onRewarded
will be called - Useful for giving the user some rewards)
then closes with a banner at the end and calls onClosed
If the showing process failed, onError
will be called with the reason as param
Implementation
Future<bool> showRewardedVideoAd(String responseId,
{Function(Map<String, String>)? onOpened,
Function(Map<String, String>)? onClosed,
Function(Map<String, String>)? onRewarded,
Function(Map<String, String>)? onError}) async {
if (!Platform.isAndroid) return false;
if (onOpened != null) _openCallbacks[responseId] = onOpened;
if (onClosed != null) _closeCallbacks[responseId] = onClosed;
if (onRewarded != null) _rewardCallbacks[responseId] = onRewarded;
if (onError != null) _errorCallbacks[responseId] = onError;
return await _channel.invokeMethod(
'TapsellPlus.showRewardedVideoAd', {'response_id': responseId});
}