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 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.

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.



About the Author

Vipul Vipul Patel

Vipul Patel is a Software Engineer currently working at Microsoft Corporation, working in the Office Communications Group and has worked in the .NET team earlier in the Base Class libraries and the Debugging and Profiling team. He can be reached at vipul_d_patel@hotmail.com

Downloads

Comments

  • There are no comments yet. Be the first to comment!

Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • As all sorts of data becomes available for storage, analysis and retrieval - so called 'Big Data' - there are potentially huge benefits, but equally huge challenges...
  • The agile organization needs knowledge to act on, quickly and effectively. Though many organizations are clamouring for "Big Data", not nearly as many know what to do with it...
  • Cloud-based integration solutions can be confusing. Adding to the confusion are the multiple ways IT departments can deliver such integration...

Most Popular Programming Stories

More for Developers

RSS Feeds

Thanks for your registration, follow us on our social networks to keep up-to-date