I have created an advertising for my windows phone 8.1 App, over pubcenter.microsoft.com. To integrate the Ad, I have taken this code:

<UI:AdControl AutoRefreshIntervalInSeconds="60" ApplicationId="8483668c-9049-4aa4-86ff-adf03e5e2cac" AdUnitId="172910" HorizontalAlignment="Left" Height="70" IsAutoRefreshEnabled="True" VerticalAlignment="Top" Width="400" Foreground="White"/>

Unfortunately, the app is mostly shown only after a minute or not at all. I testet this, with available internet connection, in a real device and in a emulator. if this "feature" is intentional, can I use Google AdMob in a Windows Phone 8.1 App?

regards, Cristian

有帮助吗?

解决方案

You can use admob as an alternative when pubcenter ads failed. Add a error_occured event handler and place the following code for this event handler. You won't need a adrotator then!

private void AdControl_ErrorOccurred(object sender, Microsoft.Advertising.AdErrorEventArgs e)
    {
        AdControl ad = (AdControl)sender;
        Grid grd = (Grid)ad.Parent;
        System.Windows.Deployment.Current.Dispatcher.BeginInvoke(() =>
        {
            AdView bannerAd = new AdView
            {
                Format = AdFormats.Banner,
                AdUnitID = AppSettings.ADMOBAPPID
            };
            AdRequest adRequest = new AdRequest();
            grd.Children.Add(bannerAd);
            bannerAd.LoadAd(adRequest);
        });
        System.Diagnostics.Debug.WriteLine(e.Error.Message);
    }

This is explained more comprehensively here http://www.windowsapptutorials.com/windows-phone/advertising/adding-microsoft-pubcenter-ads-in-windows-phone-8-apps/

其他提示

It sounds like you're issue is that you were expecting ads to always be shown. With a single ad provider this is hardly ever the case.

To answer your second question, yes you can use AdMob but you will again hit the issue that you won't get adverts displayed all the time.

The solution to this issue is to use multiple advert providers. The simplest way to implement this is with a tool like AdRotator which will make it easier to work with multiple advert providers. It's also recommended to use AdDuplex as an ultimate fallback too as this should always be able to show something.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top