Skip to content

Rewarded

To use rewarded ads, you need to request their load at some point in the app; we recommend doing so as soon as possible. This can be done by using the following code:

import { RNWortiseRewarded } from '@wortise/react-native-sdk';
RNWortiseRewarded.setAdUnitId('Wortise Ad Unit ID');
RNWortiseRewarded.loadAd();

Next, to show the ad in the desired moment, you can use the showAd() and isAvailable methods as shown in the following example:

if (await RNWortiseRewarded.isAvailable) {
RNWortiseRewarded.showAd();
}

Some listeners can be added to receive the different events that may occur during the ad lifecycle. For this, you need to use the addEventListener method and specify which event type to receive, which can be one of the following:

  • onRewardedClicked
  • onRewardedCompleted
  • onRewardedDismissed
  • onRewardedFailedToLoad
  • onRewardedFailedToShow
  • onRewardedImpression
  • onRewardedLoaded
  • onRewardedRevenuePaid
  • onRewardedShown
RNWortiseRewarded.addEventListener('onRewardedCompleted', ({ amount, label, success }) => {
// The callback will be invoked when the ad is completed
});
RNWortiseRewarded.addEventListener('onRewardedLoaded', () => {
// The callback will be invoked when an ad is loaded
});