DVLUP

Monetizing App Studio with Ads

Posted on March 7, 2014  •  3 minutes  • 527 words
Table of contents

So, you’d like to put some ads in your awesome App Studio app? No problem! I thought I would write a post to show just how easy it can be. Follow these easy steps and you’ll start earning money from ads…

Ad provider

The ad provider is the service the AdControl in your app gets the ad to display and also where you earn the revenue. As of Windows Phone 8 there is a PubCenter AdControl built into the framework, all you need to do is get an ApplicationId and an AdUnitId. You get that information from Windows Phone DevCenter , find out how to get your ApplicationId and AdUnitId in this great blog post .

If you want to use a separate Ad provider, for example AdDuplex, you’ll need to add the provider’s DLLs to your project. I’m using AdDuplex in the example below, learn how to add AdDuplex to your project here .

Step One: Enable ads in App Studio

Before generating your App Studio app, you’ll want to enable ad support. On the Publish Info tab, turn on the Enable ad client in the source code switch (see #2 in this screenshot):

<img src="http://nokiawpdev.files.wordpress.com/2014/03/app-studio-ads-1.png?w=700" alt="App Studio Screenshot">

Next, generate the app and download the source code.

Step Two: Open App in Visual Studio

After downloading the source code, you might need to unblock the binaries before unzipping the folder. This is a built-in security feature that prevents internet-downloaded code from running on your machine. Since we know where these files came from, it’s ok to go and unblock them. Here is how to do that:

  1. Right click on the downloaded zip folder
  2. Select “Properties
  3. If you see an “Unblock” button, click it. If you do not, continue to step 4.
  4. Now you can safely unzip the folder

Next, drill down into the unzipped folder until you see the Visual Studio solution file. Double click to open it in Visual Studio (Note: You need Visual Studio installed. If you do not, you’ll need to download and install the Windows Phone SDK from here ).

Step Three: AdControl on MainPage.xaml

Drill Down to MainPage.xaml, see this screenshot to help you find it:

<img src="http://nokiawpdev.files.wordpress.com/2014/03/app-studio-ads-2.png" alt="Visual Studio Solution Explorer">

Near the top of the page, you will see a commented out section of code (approximately line #50). This is the built-in AdControl. All you need to do is:

  1. Uncomment the AdControl (delete the characters before and after the AdControl)
  2. Replace the placeholder ApplicationId and AdUnitId with yours

In this screenshot, I demonstrate how to use an AdDuplex ad control instead of the built-in AdControl.

<img src="http://nokiawpdev.files.wordpress.com/2014/03/app-studio-ads-3.png?w=700" alt="MainPage">

That’s all there is to it! Now you can do a Build and publish the generated XAP file. (If you are not familiar with how to publish an app built with Visual Studio, see this documentation )

This image shows what the published app looks like running on a phone, see for yourself and download the app .

<img src="http://nokiawpdev.files.wordpress.com/2014/03/netduinoninjascreenshot.jpg?w=180" alt="NetduinoNinjaScreenshot">

Happy coding!

Lance

Here are some follow-up resources to help you monetize your apps:

Follow me on your preferred social network =>