Skip to main content

Rewarded

info

Here you can find our demo implementation of rewarded ads in Bidon.

Create An Instance

Add Bidon namespace to your script.

using Bidon.Mediation;

Create a BidonRewardedAd instance.

var bidonRewarded = new BidonRewardedAd();

Subscribe To Events

Subscribe to desired events for receiving callbacks during ad object lifecycle.

bidonRewarded.OnAdLoaded += (sender, args) =>
{
Debug.Log($"Ecpm: {args.Ad?.Ecpm}");
};

Below you can find all available events for rewarded ads.

event EventHandler<BidonAdLoadedEventArgs> OnAdLoaded;
event EventHandler<BidonAdLoadFailedEventArgs> OnAdLoadFailed;
event EventHandler<BidonAdShownEventArgs> OnAdShown;
event EventHandler<BidonAdShowFailedEventArgs> OnAdShowFailed;
event EventHandler<BidonAdClickedEventArgs> OnAdClicked;
event EventHandler<BidonAdClosedEventArgs> OnAdClosed;
event EventHandler<BidonAdExpiredEventArgs> OnAdExpired;
event EventHandler<BidonAdRevenueReceivedEventArgs> OnAdRevenueReceived;
event EventHandler<BidonUserRewardedEventArgs> OnUserRewarded;

Load

bidonRewarded.Load(0.01d);

Show

if (bidonRewarded.IsReady())
{
bidonRewarded.Show();
}

Dispose

To release resources we recommend destroying instances when you don't need them anymore.

bidonRewarded.Dispose();
bidonRewarded = null;

Send Extra Data

note

The value has to be one of the following types: bool, char, int, long, float, double, string.

Passing null as a value will remove existing KeyValuePair from dictionary.

bidonRewarded.SetExtraData("existing_key", null);

You can also read all current extras as shown below:

var extras = bidonRewarded.GetExtraData();

Win / Loss Notifications

Use the following methods to let Bidon know whether or not it won the show opportunity.

bidonRewarded.NotifyWin();
bidonRewarded.NotifyLoss("winner_demand_id", (double)winnerEcpm);