This article explains how to Monetize Windows Phone 7 application using Microsoft Advertising Ad control.
Introduction
The market for Windows Phone 7 apps is wide open for developers wanting to monetize mobile apps. That means endless opportunities for any developer looking to monetize mobile apps.
Monetization in mobile app basically allows developer to display advertisement on your mobile application, in WP7 we achieving such kind of functionality using Microsoft Advertising Ad Rotator Control. Monetized utilizing unique capability to serve ads based on *where* the person is located, *what* they are searching for (ad unit categories), and *when* they are searching (active advertising campaigns)
What is mobile monetization?
In mobile app development the term monetization is used to mean the ability to generate revenue thorough your mobile app. It can be from affiliate programs, e- commerce, premium content and advertising.
Implementation
Basic steps follow to implementation in Windows Phone 7 app.
Step-1:
Download Microsoft Advertising SDK.
Download Microsoft Advertising SDK for Windows Phone.
After download Microsoft Advertising SDK, install it on your development machine.
Step-2:
Register mobile App at Microsoft pubCenter..
Register Your Mobile App: Sign up and register your Windows Phone apps using Microsoft pubCenter. Here you can use your live or pubCenter Id.
Register your first application and create an ad unit (optional)
Enter application name:
Device type:
Ad unit name:
Ad unit size:
Select Ad category:
Excluded Url:
Step-3:
Create the Windows Phone application
1- Create a Windows Phone 7 Application project
2- Right click on project in solution explorer panel and click on Add Reference dialog box, click the Browse tab. Navigate to the location where you installed the Microsoft.Advertising.Mobile.UI.dll previously. Click the Microsoft.Advertising.Mobile.UI.dll to select it, and click OK.
3- Now configure Application Id and Ad Unit Id properties in the Ad Control.
Here is two ways to add “Ad Control” in the application using XAML and C# code behind.
Using XAML
Drag and drop the Ad Control to Windows Phone 7 xaml page and configure Application Id and Ad Unit Id properties in xaml.
See below code snippet:
<my:AdControl Foreground="Red"AdUnitId="10020750"ApplicationId="e1e3c23b-3a59-4119-852e-8ad0a7f78f11"Height="80"HorizontalAlignment="Left"Margin="0,6,0,0"Name="adControl1"VerticalAlignment="Top"Width="480"IsAutoRefreshEnabled="True" />
Using (C#) code behind
Double click on the Windows Phone7 Page, it will automatically open the code behind of a page. And using the AdControl API which is a managed api. Include the Microsoft.Advertising.Mobile.UI namespace in the project. And create an instance of the AdControl Class and set the properties of the AdControl class instance or you can directly pass it to AdControl constructor.
See below code snippet:
private const string APPLICATION_ID = "";private const string AD_UNIT_ID = "";//private AdControl adControl;// Constructorpublic MainPage(){InitializeComponent();this.Loaded += new RoutedEventHandler(MainPage_Loaded);this.Unloaded += new RoutedEventHandler(MainPage_Unloaded);}void MainPage_Loaded(object sender, RoutedEventArgs e){if (!string.IsNullOrEmpty(APPLICATION_ID) && !string.IsNullOrEmpty(AD_UNIT_ID)){adControl = new AdControl(APPLICATION_ID,AD_UNIT_ID,true);// Make the AdControl size large enough that it can contain the imageadControl.Width = 480;adControl.Height = 80;adControl.Keywords = "Windows Phone 7, Hotels, Travels, Gold";ContentPanel.Children.Add(adControl);}else{MessageBox.Show("To show ads in this application, insert the application ID and an ad unit ID into your code as explained..");}}void MainPage_Unloaded(object sender, RoutedEventArgs e){ContentPanel.Children.Remove(adControl);}
Run the application by using F5 button, and you will see a sample of Monetization in Windows Phone 7 Application.
Thanks you!
Happy Coding
0 comments:
Post a Comment