Skip to main content

Rewarded Ads

This page is describes how to implement rewarded ads though the BidOn SDK.

Loading an Rewarded Ad​

To load an interstitial ad, instantiate an BDNRewardedAd with placement configured in the app settings. Implement BDNRewardedAdDelegate that you are notified when your ad is ready and of other ad-related events. In the load method you will need to specify the pricefloor. This argument can be ad revenue value from mediaton.

class ViewController: UIViewController {
var rewardedAd: Bidon.RewardedAd!

// Auction Keys correspond to the Auction Configurations that you can create in the Bidon Admin Panel
func loadRewardedAd() {
rewardedAd = Bidon.RewardedAd(
auctionKey: String? = nil
)
rewardedAd.delegate = self

rewardedAd.loadAd(with: 0.1)
}
}


extension ViewController: Bidon.RewardedAdDelegate {
func adObject(_ adObject: Bidon.AdObject, didLoadAd ad: Bidon.Ad, auctionInfo: Bidon.AuctionInfo) {}

func adObject(_ adObject: Bidon.AdObject, didFailToLoadAd error: Error, auctionInfo: Bidon.AuctionInfo) {}

func adObject(_ adObject: Bidon.AdObject, didFailToPresentAd error: Error) {}

func fullscreenAd(_ fullscreenAd: Bidon.FullscreenAdObject, willPresentAd ad: Bidon.Ad) {}

func fullscreenAd(_ fullscreenAd: Bidon.FullscreenAdObject, didDismissAd ad: Bidon.Ad) {}

func rewardedAd(_ rewardedAd: Bidon.RewardedAdObject, didRewardUser reward: Bidon.Reward, ad: Bidon.Ad) {}
}

Showing an Rewarded Ad​

func showRewardedAd() {
guard rewardedAd.isReady else { return }
rewardedAd.showAd(from: self)
}

Handle a User Reward​

Once a Rewarded Ad did reward user, delegate method rewardedAd:didRewardUser will fire. You will be able to receive reward amount and currency.

func rewardedAd(_ rewardedAd: Bidon.RewardedAdObject, didRewardUser reward: Bidon.Reward) {
let amount: Int = reward.amount
let currency: String = reward.label
}