AdMediator允许为自家广告指定0权重(备份模式),在这种情况下(据我所知),只有在其他广告不可用时才会显示自家广告。在我的位置它经常发生,它真的很容易看到一些东西,而不是空白点。
我想使用Store Services SDK中的Microsoft AdMeditor实现这个想法。这就是我要做的事情:
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();
}
.............
}
我收到错误代码RefereshNotAllowed!
事实上,广告之间30秒的最短超时时间是有道理的。但是,如果单位ID更改,则应重置!
我试图重新创建控件,希望这可能会重置超时。没办法 - 看起来静态处理超时!
还有其他想法吗?