Adding Ads: Windows Phone 8 app

I make an effort to never click on an ad, anywhere. As you might imagine, I don’t agree with, nor understand Google’s business model. With that said, there is obviously something to this advertising nonsense. So, how do you add ads to your: website, blog, and apps? I’ll do a series of blog posts as I learn how, myself!

I started today with adding an advertisement to the main screen of my Windows Phone 8 app. Here’s what I did…

In Visual Studio, I first added an “Ad Control” (from the Toolbox) to my main page.

mx32368

What I really wanted to do was to push down the “top” of the page, and have the ad take up the top portion of the screen. So, I added a “RowDefinition” to put my ad control in row 0, and put the rest of the content into row 1. I changed this on my MainPage.xaml:

mx3A44B

to this:

mx3FE04

That means I can now put the main content (in this example case, a PivotTable) in row 1:

mx39D03

and put my ad control up in row 0:

mx370CE

It’s also important to note that you MUST add some new “capabilities” to your WMAppManifest.xml file. You must add (on the Capabilities tab):

  • ID_CAP_IDENTITY_USER
  • ID_CAP_MEDIALIB_PHOTO
  • ID_CAP_PHONEDIALER

Why? I don’t know. I read how to do most of this from this MSDN article, and it’s just what is needed to make this work. What does that buy us? Here is the before and after:

Before After

As you can see, the advertisement is 80px tall and takes up row 0 – and the rest of the content of this page takes up row 1.

That gets us technically-working in the app, but how do you show actual, real ads? And how do you get paid from that? Well, on the Microsoft platform for Windows Phone and Windows 8.x apps, you have to go to PubCenter:

http://pubcenter.microsoft.com

It’s pretty self-explanatory. You create a new profile, register your app – and they give you an AdUnitId and ApplicationId. You might remember that our AdControl needs just that! So, go back into your XAML in your app, take out the sample values and point to the real thing:

mx3C163

Please note:

Once you point to real ads, you won’t see that ad placeholder anymore in the Windows Phone Emulator. You (apparently) will only see them on an actual Windows Phone device. For this reason, I’m not sure if there are any more steps, because I can’t test without putting this on my phone first!

That’s about it! Version your app, go publish it in the Windows Phone store and you should be all set. Well, I think so at least. I just published an update my app, we’ll see if the ads actually work or not.

Posted in Ads, Mobile, Uncategorized, WindowsPhone

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Archives
Categories

Enter your email address to follow this blog and receive notifications of new posts by email.

Join 2 other followers

%d bloggers like this: