我正在尝试通过通用 Windows 通过我的应用获利。我按照官方教程进行操作,但是当我尝试加载插页式广告时,总是出现以下错误:
Interstitial ad is not ready. With this error code: ClientConfiguration.
Failed to make http requestError. With this error code: NetworkConnectionFailure.
我不知道我错过了什么。
这是我的代码:
public sealed partial class Myclass: Page {
InterstitialAd MyVideoAd;
public MyClass() {
this.InitializeComponent();
var MyAppId = "d25517cb-12d4-4699-8bdc-52040c712cab";
var MyAdUnitId = "11389925";
MyVideoAd = new InterstitialAd();
MyVideoAd.ErrorOccurred += MyVideoAd_ErrorOccurred;
MyVideoAd.RequestAd(AdType.Video, MyAppId, MyAdUnitId);
}
private void MyVideoAd_ErrorOccurred(object sender, AdErrorEventArgs e) {
String errrorMessage = e.ErrorMessage;
String errorCode = e.ErrorCode;
}
private void showInterstitial(object sender, TappedRoutedEventArgs e) {
MyVideoAd.Show();
}
}
当我执行应用程序时,在 MyVideoAd_ErrorOccurred
方法启动几秒钟后,我使用了 errorMessage
和 errorCode
的值说。这发生在我的 Windows 10 移动设备和桌面机器执行中。 adUnit
代码和application id是微软页面提供的用于测试
我希望你能帮助我。
最佳答案
对于 UWP 应用程序,请安装 Microsoft Universal Ad Client SDK并使用 AdMediatorControl。
引用资料:
检查我的样本:https://github.com/Myfreedom614/UWP-Samples/tree/master/AdClientUWPApp
关于xaml - UWP:无法加载和显示插页式视频广告,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35067079/