Universal Windows Dev

How to: Adding adverts to your Windows Phone apps

By 6th April 2012 No Comments

I’m just posting this for all those out there who are actually after making money with your Windows Phone apps. Unless your app is super awesome, you probably won’t make much money from putting your apps on the marketplace for a price. I think everyone knows that as a fact. People are looking for something that is worth paying for. There is an exception for your XNA games as there seems to be people out there who will just purchase games, but for Silverlight applications no-one is going to buy an app that they don’t seem worth buying.

If you intend on releasing an app on the marketplace that you want to make money on, then ALWAYS have the trial function built into your app. That way users can try the app before buying it. It’s great for a user to know what your app is going to be like before they consider purchasing it. You wouldn’t just go into a shop, just pick up a random game and purchase it. With games, most people like playing a demo.

Remember that your trial version is a TRIAL. Take out some functionality so that the user can experience the basics of your app, then it’s another incentive to but your app.

With money in your mind, add adverts into your trial version. You may not believe it, but most of the time you end up making most of your money from adverts in your applications. Many users don’t like having adverts in applications so remember to place them wisely. Also, having adverts in an app is an incentive for the user to purchase the full version to be rid of them.

Adding adverts into your Silverlight application couldn’t be easier.

I will go through the steps with you here:

  1. If you haven’t already, download the Microsoft Advertising SDK for Windows Phone
  2. Once you’ve downloaded and installed the SDK, open up your Visual Studio Solution
  3. Go to any of your .xaml files so the Toolbox shows up on the left
  4. If you don’t see a new item called AdControl in your Windows Phone Controls, right-click the tab and go to “Choose Items”. If you do see this skip to step 7
  5. Click on “Browse” at the bottom of the new window, and navigate to where you installed the SDK. e.g. “C:Program Files (x86)Microsoft SDKsAdvertising for PhoneLibrariesv7.1”
  6. Add the Microsoft.Advertising.Mobile.UI.dll. You should now see the AdControl item in your Windows Phone Controls tab
  7. Drag the AdControl item onto the page where you would like the advert to be. If you are placing it below items you will have to resize these items so the advert doesn’t block over them
  8. Next you want to head over to the Microsoft Advertising PubCenter to set up an account and get your first adverts ready for your application
  9. When you’ve registered your first application, you will receive an Application ID which should look like this:
    “xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx”
  10. You then have to set up an Ad Unit via the website. Once you’ve set up that you should get an Ad Unit ID which should look like this:
    “xxxxxxxx”
  11. Let’s bring these two codes over to your app! If you click on the AdControl item in your app, it should get Highlighted in the XAML code. Locate the AdUnitId=”xxxxxxxx” and replace this with your AdUnitId you were given by the pubCenter. Do the Same for the ApplicationID. Each app you put ads in needs a new AppID but not a new AdUnitId.
  12. This is a little extra code you can add into your page’s constructor which sets the ads to refresh themselves:
    adControl1.IsAutoRefreshEnabled = true;
    adControl1.IsAutoCollapseEnabled = true;

And that’s it. In the emulator you probably won’t see any adverts but you can test the adverts on your Windows Phone 7 device. Get your application published and start making money 🙂

 

*  If you enjoyed this please read this article on the London 2012 Olympics: http://bit.ly/IaTK1X

Author James Croft

James is a .NET developer for Black Marble Ltd. with over 5 years app development experience in Microsoft platforms. He enjoys blogging, helping others learn to code, making YouTube videos, spending time with his girlfriend but most of all, penguins.

More posts by James Croft

Leave a comment