0

AdMediator allows specify 0 weight (backup mode) for House Ads, in which case (as far as I understand it), house ads appear only if other ads are unavailable. In my place it happens so often, that it really makes sence to see something instead of blank spot.

I wanted to implement the idea using Microsoft AdMeditor from Store Services SDK. This is how I was going to do that:

using MsAdControl = Microsoft.Advertising.WinRT.UI.AdControl;

......

private MsAdControl createMicrosoftAdControl() {
     MsAdControl msAdControl = new MsAdControl();
     msAdControl.AdRefreshed += OnMsAdRefreshed;
     msAdControl.ErrorOccurred += OnMsBannerError;

     msAdControl.ApplicationId = msBannerAppId;
     msAdControl.AdUnitId = msBannerUintId;
     msAdControl.AutoRefreshIntervalInSeconds = 30;
     msAdControl.IsAutoRefreshEnabled = true;
      ...... 

     return msAdControl;
 }

  // Callbacks
 private void OnMsAdRefreshed(object sender, RoutedEventArgs e) {
     var adControl = (MsAdControl)sender;
     adControl.AdUnitId = msBannerUintId;   // Revert to other ads
     .......
}

 private void OnMsBannerError(object sender, AdErrorEventArgs e) {
     var adControl = (MsAdControl)sender;

     if (adControl.AdUnitId != msBannerUintId) 
         adControl.AdUnitId = msBannerUintId;   // Revert to other ads
     else 
     if (e.ErrorCode == MsErrCode.NoAdAvailable) {
         adControl.AdUnitId = msBannerHouseUintId;   // Use house ads
         adControl.Refresh();
     }

     .............  
}

I get error code RefereshNotAllowed!

Indeed, a 30-sec minimum timeout between ads makes sense. However, if unit id changes it should be reset!

I tried to re-create control in hope this may reset the timeout. No way - it looks like timeout is processed statically!

Any other ideas?

Cherry Bu - MSFT
  • 10,160
  • 1
  • 10
  • 16
cyanide
  • 3,885
  • 3
  • 25
  • 33
  • You might refer to [Ad Not refreshing](https://learn.microsoft.com/en-us/windows/uwp/monetize/xaml-and-c-troubleshooting-guide#xaml-adsnotrefreshing). When using manual refresh, Refresh should be called only after a minimum of 30 to 60 seconds depending on the device’s current data connection. – Zhendong Wu - MSFT Apr 10 '17 at 01:54
  • Extactly. Manual refresh doesn't help. Having a separate AdControl for Home Ads doesn't help either. The only hope is that Microsoft will either upgrade AdControl to allow specifying a backup ad source, or release AdMediator for UWP with this feature. – cyanide Apr 18 '17 at 03:01

0 Answers0