How to Create Advertisement-supported Windows Phone Applications | CodeGuru

How to Create Advertisement-supported Windows Phone Applications

Introduction Developers today are giving away their applications for free. Yes, you heard it right. Free! Zilch! Nada! Why, one may ask, would someone want to give away their application for free after all the hard work they have put into it? They would do it for advertisement revenue. Even though the initial return on […]

Written By
CodeGuru Staff
CodeGuru Staff
Oct 26, 2011
2 minute read
CodeGuru content and product recommendations are editorially independent. We may make money when you click on links to our partners. Learn More

Introduction

Developers today are giving away their applications for
free. Yes, you heard it right. Free! Zilch! Nada! Why, one may ask, would
someone want to give away their application for free after all the hard work
they have put into it? They would do it for advertisement revenue. Even though
the initial return on investment might be zero, they would make up for it over
the long run from the advertisement revenue.

Like the iOS and the Android platforms, Microsoft’s Windows
Phone
platform also offers an advertisement platform. Windows Phone
developers can integrate “Microsoft
Advertising Mobile Ads
” into their mobile application. This will allow
Microsoft Advertising Network to delivers advertisements to the users and the
application developer will keep a share of the revenue generated from the
advertisements delivered.

To get started, developers would need to create a Microsoft
pubCenter account.

Creating pubCenter account

In order to develop Windows Phone applications that can
deliver advertisements, you need to create a pubCenter application. Developers
will need to visit https://pubcenter.microsoft.com
and register to get an account by clicking on the link that says “Sign up now”.

Microsoft Advertising pubCenter
Figure 1: Microsoft Advertising pubCenter

Select the appropriate location and click Continue.

On the next screen, you can optionally register your first
application and create an ad unit.

Register your first application and create an ad unit
Figure 2: Register your first application and create an ad unit

You can choose which kinds of advertisements will be served.
You can also exclude advertisements which might direct customers to certain
sites (for example, your competitor’s site).

Once you create an ad unit, note down the Ad Unit ID and the
application ID.

Advertisement

Hands-On

Let us create a simple Silverlight
based Windows Phone application, which delivers advertisements.

Create a simple Windows Phone application by using the
“Windows Phone application” template.

The
Figure 3: The “Windows Phone application” template

Let us call it WindowsPhoneAdDemo.

Select the Target Windows Phone OS Version to 7.1

New Windows Phone Application
Figure 4: New Windows Phone Application

After the MainPage.xaml page is rendered, drag and drop the
AdControl from the ToolBox.

Drag and drop the AdControl from the ToolBox
Figure 5: Drag and drop the AdControl from the ToolBox

Move the Ad Control to the bottom of the page.

Move the Ad Control
Figure 6: Move the Ad Control

Now, we need to modify the AdUnitId and ApplicationId
properties of the Ad Control instance.

By default, the values of AdUnitId will be Image480_80 and
ApplicationId will be “test_client”.

<my:AdControl AdUnitId="Image480_80" ApplicationId="test_client" Height="80" HorizontalAlignment="Left" Margin="0,521,0,0" Name="adControl1" VerticalAlignment="Top" Width="480" />

Go ahead and start debugging the application.

You will notice that the Microsoft Advertising banner will
appear.

The Microsoft Advertising banner
Figure 7: The Microsoft Advertising banner

Now, to put out real advertisements, you will need to
replace the test values of AdUnitId and ApplicationId with the values that are
assigned via Microsoft pubCenter.

Now, when you run the application, you will get advertisements.

When you run the application, you will get advertisements
Figure 8: When you run the application, you will get advertisements

If you are having trouble following the steps mentioned
here, you can get the sample code below.

Summary

In this article, we learned how to create a Windows Phone
application with advertisements.

CodeGuru Logo

CodeGuru covers topics related to Microsoft-related software development, mobile development, database management, and web application programming. In addition to tutorials and how-tos that teach programmers how to code in Microsoft-related languages and frameworks like C# and .Net, we also publish articles on software development tools, the latest in developer news, and advice for project managers. Cloud services such as Microsoft Azure and database options including SQL Server and MSSQL are also frequently covered.

Property of TechnologyAdvice. © 2026 TechnologyAdvice. All Rights Reserved

Advertiser Disclosure: Some of the products that appear on this site are from companies from which TechnologyAdvice receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. TechnologyAdvice does not include all companies or all types of products available in the marketplace.