VMAX also supports video ads with incent provision. These are video ads which on view completion will provide some virtual currency to users.
Vmax SDK supports wallet management to maintain walletElements also known as currency name which stores respective currency amount or total reward amount. And provides provision of getting total virtual currency, spending virtual currency, awarding virtual currency.
Below snippet shows the example of requesting Vast MarkUp Ads
Initialize the adview object
1 2 3 4 5 |
// Set proper adspot id and ux type VMAXAdView adView = new VMAXAdView(); adView.AdspotId = "MY_ADSPOT_ID"; adView.UX= AdUX.Interstitial; |
Initialize wallet object
1 2 3 4 5 6 7 |
Wallet wallet = Wallet.GetWallet(); //Create a wallet element WalletElement element = wallet.AddWalletElement("SampleWalletPath", "CurrencyName"); //SampleWalletPath is just a url for the icon for your virtual currency. This icon // will be reflected on to the message boxes related to Rewarded Videos in the future // sdk releases. As of now, this will not show up. You can pass it as an empty string. |
Rewarded Video
1 |
RewardedVideo rv = new RewardedVideo(element); |
1 2 3 4 5 |
Dictionary<string, string> headers = new Dictionary<string, string>(); headers.Add("name", "john"); headers.Add("reward", "gold"); rv.SetCustomData = headers; |
1 2 3 4 5 |
rv.showCappingPopup = true; rv.showInterruptedPopup = true; rv.showPrePopup = true; rv.showPostPopup = true; |
1 2 3 4 5 6 7 8 9 |
rv.PrePopupText = "Watch this video and get <reward> <currency>"; rv.PrePopupTitle = "VMAX"; rv.PostPopupText = "You earned <reward> <currency>"; rv.PostPopupTitle = "VMAX"; rv.InterruptedPopupText = "You will lose your reward"; rv.InterruptedPopupTitle = "VMAX"; rv.CappingPopupText = "Daily maximum count to view the ad reached"; rv.CappingPopupTitle = "VMAX"; |
1 2 3 4 5 6 |
element.OnUpdateFailedVirtualCurrency += Element_OnUpdateFailedVirtualCurrency; element.OnUpdateVirtualCurrency += Element_OnUpdateVirtualCurrency; rv.OnRewardedVideoCompleted += Rv_OnRewardedVideoCompleted; rv.OnRewardedVideoInterrupted += Rv_OnRewardedVideoInterrupted; rv.OnRewardedVideoPlaybackError += Rv_OnRewardedVideoPlaybackError; |
1 |
adView.InitRewardedVideo(rv); |
1 |
adView.LoadAd(); |
1 |
element.AwardVirtualCurrency(100); |
1 |
element.SpendVirtualCurrency(20); |
1 |
element.GetVirtualCurrency(); |