1. Add Library "Microsoft Advertising SDK for XAML" to References.
2. Create Video Adds in PubCenter
3. Write your code in MainPage.cs
using Microsoft.Advertising.WinRT.UI;
4. Write in MainPage()
InterstitialAd MyVideoAd = new InterstitialAd();
MainPage()
{
var MyAppId = "85a2b1b7-73ac-4d11-884f-323f6fa58aa0"; //this can find in your pub center
var MyAdUnitId = "251474";
MyVideoAd.AdReady += MyVideoAd_AdReady;
MyVideoAd.RequestAd(AdType.Video, MyAppId, MyAdUnitId);
}
private void MyVideoAd_AdReady(object sender, object e) {
if ((InterstitialAdState.Ready) == (MyVideoAd.State)) {
MyVideoAd.Show();
}
}
Done for Microsoft Advertising Video Ads!
How to implement In App Purchase(IAP)?
if (!AppLicenseInformation.ProductLicenses["RemoveAds"].IsActive) {
try {
// The customer doesn't own this feature, so
// show the purchase dialog.
PurchaseResults results = await CurrentAppSimulator.RequestProductPurchaseAsync("RemoveAds");
//Check the license state to determine if the in-app purchase was successful.
if (results.Status == ProductPurchaseStatus.Succeeded)
{
AdMediator_4BF1A7.Visibility = Visibility.Collapsed;
appBar.Visibility = Visibility.Collapsed;
}
}
catch (Exception ex)
{ // The in-app purchase was not completed because
// an error occurred.
throw ex;
}
} else
{
await new Windows.UI.Popups.MessageDialog("You already Purchase Remove Ads ").ShowAsync();
}
*Reminder to include IAP during App Submission.
Done for In App Purchase(IAP) !
Happy Coding!