WinCoder Blog

Add Pubcenter Ads to App Studio Apps

App Studio is an awesome web-interface for creating fully functional Windows Phone 8 apps.  It has support for displaying a variety of content from various mechanisms is multiple stylized ways.  It is similar to XPCK, but affords you the ability to develop and create a store publishable .xap with nothing more than a web browser!

For those wishing to add Pubcenter Ads to an App Studio app, this walkthrough will help you get started.  There isn’t a one-size fits all solution, as the source code generated by App Studio is dependent on the template you select and the features you add to it.  This post will help you determine how to find the proper place to insert your Pubcenter Ad Control.

First you will want to download your project source code from App Studio and open it in Visual Studio:

AppStudioSource

Notice in my app I have the following in my View folder:

ViewList

When I build the app, I am greeted with:

AppStudio

So, going of the previous list of Views, I assume that if I want an ad on this page, my best guess would be \Views\start_Menu.xaml

Next, I open this file in Visual Studio:

VS1

I see errors, but the XAML is rendering properly, so I simply ignore them.

Next, I add a row to the LayoutRoot grid and create a text box in the new row:

    <Grid x:Name="LayoutRoot">
        <Grid.RowDefinitions>
            <RowDefinition Height="*"/>
            <RowDefinition Height="80"/>
        </Grid.RowDefinitions>
        <TextBlock Text="test" Grid.Row="1"/>

We can see that it renders properly in the design view:

VS2

From here,  follow the instructions @ http://msdn.microsoft.com/en-us/library/advertising-mobile-windows-phone-8-adcontrol-walkthrough-api(v=msads.20).aspx and implement an AdControl in place of the TextBlock and you should be good to go!


Leave a Reply

Your email address will not be published. Required fields are marked *