簡體   English   中英

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

[英]C#/XAML WP8.1 Adding Leadbolt Ad controls

我想添加Leadbolt廣告控件,就像這里的Leadbolt集成指南

首先,我下載了適用於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 {公共密封的子類MainPage:頁面{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應用程序一起使用的廣告提供商,它現在是pubCenter,填充率接近0%?

我猜那是因為您在Windows Phone 8.1 SDK上使用Windows 8 SDK,這會導致不兼容問題

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM