C#/ XAML WP8.1添加Leadbolt Ad控件

时间:2014-08-31 14:43:03

标签: c# xaml windows-phone-8 windows-phone-8.1 leadbolt

我想添加leadbolt广告控件,就像这里一样 leadbolt integration guide

首先,我下载了适用于Windows Phone 8.1的Leadbolt SDK。 然后我创建了新的Windows Phone应用程序。有一个来自MainPage.xaml的代码:

<Page
x:Class="App6.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:App6"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">

<Grid Name="adWrapperGrid" >
    <!-- wrap your content with grid -->
    <Grid Name="yourContentGrid" Background="{StaticResource ApplicationPageBackgroundThemeBrush}">
    </Grid>
</Grid>

和MainPage.xaml.cs

using LeadBolt.Windows8.AppAd;

命名空间App6 {     公共密封部分类主页:页面     {         private AdController myController;         公共MainPage()         {             this.InitializeComponent();

        this.NavigationCacheMode = NavigationCacheMode.Required;
    }

    protected override void OnNavigatedTo(NavigationEventArgs e)
    {
        adWrapperGrid.Loaded += adWrapperGrid_Loaded;
    }

    void adWrapperGrid_Loaded(object sender, RoutedEventArgs e)
    {
        myController = new AdController(adWrapperGrid, "YOUR_LB_SECTION_ID");
        myController.LoadAd();
    }

    protected override void OnNavigatedFrom(NavigationEventArgs e)
    {
        myController.DestroyAd();
        adWrapperGrid.Loaded -= adWrapperGrid_Loaded;
        base.OnNavigatedFrom(e);
    }
}

}

所以,我正在做一切就像在链接中一样,但当我启动该应用程序时,它会显示一个空白屏幕,没有广告。

有人可以帮忙吗?或推荐其他适用于Windows Phone 8.1应用程序的广告提供商,现在它是一个填充率接近0%的pubCenter?

1 个答案:

答案 0 :(得分:0)

我想这是因为你在Windows Phone 8.1 SDK上使用Windows 8 SDK导致了不兼容问题