WEBINAR: On-demand webcast
How to Boost Database Development Productivity on Linux, Docker, and Kubernetes with Microsoft SQL Server 2017 REGISTER >
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.
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".
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.
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.
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.
Figure 3: The "Windows Phone application" template
Let us call it WindowsPhoneAdDemo.
Select the Target Windows Phone OS Version to 7.1
Figure 4: New Windows Phone Application
After the MainPage.xaml page is rendered, 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.
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.
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.
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.
In this article, we learned how to create a Windows Phone application with advertisements.