Tag: Windows Phone 8

Using Microsoft pubCenter with AdDuplex

Not everyone realises but when you put an ad control such as Microsofts pubCenter control in your app, it doesn't mean that every single user will see an ad every single time. Microsoft and any other ad provided has a limited number of ad's to show based on the number they've sold. So sometimes there just isn't an ad to show. This is referred to as fill rate, usually expresses as a percentage this tells you what percentage of requests to show an ad actually resulted in an ad being shown.

Not having 100% fill rates causes 2 issues. Firstly your not maximising your revenue as people are using your app but not seeing an ad. Secondly, unless you've designed for it, there's potentially an odd looking blank space in your app where an ad is meant to go.

There is a solution though, when an ad isn't received by the ad control it does at least fire an event to inform you that this has happened. You can either then do something to update your UI or show something else in its place like another ad control.

The second ad control I am using is AdDuplex. Unlike a traditional ad, this isn't going to pay me out any money. Instead its specifically for Windows Phone developers to promote there apps and works on a basis that if you show an ad, your ad will get shown on another app. For every 10 ads your app shows, 8 of yours will be shown on other apps. The remaining 2 ad spaces are used by AdDuplex to make there money. The benefit of this system is there is a 100% fill rate, so your ad space is used to its full potential.

Enough talk, show me the code

In the xaml mark-up I have a MS pubCenter ad control and an AdDuplex control along with the properties set to make them fit the layout of my page. Nothing special over what you would normally do here, other than the fact there's 2 controls on top of each other and the AdDuplex one is collapsed.

1<UI:AdControl Name="MSAdControl" ApplicationId="YOUR APP ID"
2 AdUnitId="YOUR AD UNIT ID" HorizontalAlignment="Left"
3 Height="80" VerticalAlignment="Top" Width="480" BorderThickness="0" Grid.Row="0" />
4<adduplex:AdControl x:Name="AdDuplexAdControl"
5 AppId="YOUR APP ID" Visibility="Collapsed" />

In the code behind I'm setting up 2 event handlers on the MS pubCenter control for error occurred and ad refreshed.

The error occurred even will get fired when an Ad isn't loaded. In that instance I need to show the AdDuplex control. Having an event on the ad refreshed control also ensures that if an ad ever does manage to display the control will be shown again.

1public MainPage()
2: base()
3{
4InitializeComponent();
5MSAdControl.ErrorOccurred += MSAdControl_ErrorOccurred;
6MSAdControl.AdRefreshed += new EventHandler(MSAdControl_NewAd);
7}
8
9void MSAdControl_ErrorOccurred(object sender, Microsoft.Advertising.AdErrorEventArgs e)
10{
11System.Windows.Deployment.Current.Dispatcher.BeginInvoke(() =&gt;
12{
13MSAdControl.Visibility = Visibility.Collapsed;
14AdDuplexAdControl.Visibility = Visibility.Visible;
15});
16}
17
18void MSAdControl_NewAd(object sender, EventArgs e)
19{
20System.Windows.Deployment.Current.Dispatcher.BeginInvoke(() =&gt;
21{
22AdDuplexAdControl.Visibility = Visibility.Collapsed;
23MSAdControl.Visibility = Visibility.Visible;
24});
25}

Windows Phone: Sharing Content

If you writing an app and want to add some social sharing capabilities like posting link to Facebook or twitter. Your initial approach may be to go to and check out each of their api’s or to go to codeplex and search for a C# api someone’s written that makes the integration simpler. But right from that start Windows Phone has had a much simpler way of doing things.

The ShareLinkTask provides a simple way to post messages to any social network the user has registered on their phone. You don’t need to do anything with authorising your app with facebook etc which not only makes things easier for you, but your users are also pleased as they don’t have to worry about what you may be doing with their passwords.

It also only takes 4 lines of code. Simply create an instance of the ShareLinkTask, set the tile and message and call the show function:

1ShareLinkTask shareLinkTask = new ShareLinkTask();
2shareLinkTask.LinkUri = new Uri("http://www.himynameistim.com");
3shareLinkTask.Message = "Check out this great blog";
4shareLinkTask.Show();

As well as the ShareLinkTask there is also a ShareStatusTask and ShareMediaTask that can be used if you just want to post a status update or post and image.

1ShareStatusTask shareStatusTask = new ShareStatusTask();
2shareStatusTask.Status = "I'm developing a Windows Phone application!";
3shareStatusTask.Show();
4
5ShareMediaTask shareMediaTask = new ShareMediaTask();
6shareMediaTask.FilePath = path;
7shareMediaTask.Show();

Social media isn’t the only way of sharing content on a phone though, there is also email and sms. Both of these are just as easy to do as social media though:

For email use the EmailComposeTask

1EmailComposeTask emailComposeTask = new EmailComposeTask();
2emailComposeTask.Subject = "Awesome website";
3emailComposeTask.Body = "Foo bla bla";
4emailComposeTask.Show();

And for SMS use the SmsComposeTask

1SmsComposeTask smsComposeTask = new SmsComposeTask();
2
3smsComposeTask.To = "2065550123";
4smsComposeTask.Body = "Try this new application. It's great!";
5
6smsComposeTask.Show();

For more information have a look at the MSDN documentation:

Share Link Task - http://msdn.microsoft.com/en-us/library/windowsphone/develop/hh394009(v=vs.105).aspx

Share Status Task - http://msdn.microsoft.com/en-us/library/windowsphone/develop/hh394027(v=vs.105).aspx

Share Media Task - http://msdn.microsoft.com/en-us/library/windowsphone/develop/jj207027(v=vs.105).aspx

Email Componse Task - http://msdn.microsoft.com/en-us/library/windowsphone/develop/hh394003(v=vs.105).aspx

SMS Compose Task - http://msdn.microsoft.com/en-us/library/windowsphone/develop/hh394005(v=vs.105).aspx

Windows Phone: Rate My App

If you want your app to succeed one thing you need is reviews. More importantly you need good reviews!

Stats show that if an app has a rating of 4 stars or above it will do significantly better than an app with less. The higher the number of reviews, the more believable that rating is.

One issue you may have though is how to get reviews. Sadly most users don't rate apps unless they really like it or hate it. The Windows Phone OS also does nothing to prompt people to rate apps, so if you want to build up reviews then your going to need to do the prompting yourself.

The code to direct someone to the review page in the store for your app is quite simple. But even better is the fact Nokia have produced sample code that does the whole process!

Once you've integrated the code on the 5th launch of your app the user will see a prompt asking them to rate your app. If they choose not to then they will be prompted to send you feedback via email.

If they didn't rate your app then on the 10th launch they will be prompted again.

Now getting good reviews is slightly harder, for that your actually going to have to build a good app that people like.

You can download the Rate My App code from Nokia here.