C#/XAML WP8.1 Adding Leadbolt Ad controls

287 Views Asked by At

I want to add leadbolt ad controls, just like here leadbolt integration guide

Firstly, I downloaded Leadbolt SDK for Windows Phone 8.1. Then I created new Windows Phone app. There is a code from 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>

And MainPage.xaml.cs

using LeadBolt.Windows8.AppAd;

namespace App6 { public sealed partial class MainPage : Page { private AdController myController; public 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);
    }
}

}

So, I'm doing everything just like in the link but when I launch that app it shows me a blank screen, without Ad.

Anybody can help? Or recommend other Ad provider that works with Windows Phone 8.1 apps, and it's now a pubCenter with fill rate close to 0%?

1

There are 1 best solutions below

0
On

I guess that is because you're using the Windows 8 SDK on a Windows Phone 8.1 SDK which is causing incompatibility issue