Universal App Tutorials Part 12 : Universal App Reviews

One of the most compelling reasons to download an app is the number of Universal App Reviews in the store.  This tutorial will look at adding a Review App Button to our completely empty About Page.  There are various places you can surface the Review App Function, commonly it’ll be available on an About or Info page, or you may choose to have a Review Reminder.  As with a number of things with UWP apps, the Universal App Review Method changed slightly from Windows Phone 8’s MarketPlaceTask, let’s take a look…

Outcome

By the end of this tutorial there should be a functional Review App Button on our About Page.  The Review App page on the store won’t be available until your app is successfully published.

Pre-requisites

Implementation

ViewModel

We’ll need an AboutViewModel.

  • Create the AboutViewModel.cs class;
  • Create an About Property on the ViewModelLocator;
  • Register it with our Service Locator in the ViewModelLocator;
  • Wire it up to the About View’s DataContext.

…as in Tutorial 1.

In order to navigate to the Review App page within the Windows Store, we’ll look at using the ms-windows-store URI Scheme.  The recommended approach is to use the Product ID, which you’ll need to get from the Windows Dev Dashboard.   The process is described here, it’s part of the URL for Windows 10 (I think this could be more explicit!).

As before, we’ll be using a RelayCommand.  Create a ReviewApp RelayCommand on the AboutViewModel.

[csharp]
public AboutViewModel()
{
ReviewAppCommand = new RelayCommand(ReviewAppAction);
}

public RelayCommand ReviewAppCommand { get; private set; }

private void ReviewAppAction()
{

}
[/csharp]

Let’s fill in the ReviewAppAction Method.

[csharp]
private async void ReviewAppAction()
{
string reviewAppUri = string.Format("ms-windows-store://review/?ProductId={0}", AppProductId);
await Launcher.LaunchUriAsync(new Uri(reviewAppUri));
}
[/csharp]

Note the Store Uri described in the specification, we’re adding a constant value for our Product Id ascertained from the Store, and then Launching the Uri Asynchronously, via the Launcher class.  The method has now become Asynchronous too as a result of using async methods with the await key word.

View

We should now be in a position to create a Button and Bind it to our ReviewAppCommand on the View Model.

[xml]
<Button x:Name="button" Content="Review App" Command="{Binding ReviewAppCommand}" Height="200" Width="200"/>
[/xml]

Again, not too fussed about the styling just yet, we’ll revisit, but as you can see the Command is binding against the ReviewAppCommand on the ViewModel.

Review App Button on About Page
Review App Button on About Page

Summary

Where are we?

  • We created an AboutViewModel;
  • We created a ReviewApp Method;
  • We created a button and wired up the ReviewAppCommand to the newly created AboutViewModel.

Where are we heading?

We’ll look at:

  • adding some more functionality to the app to swap the translation direction;
  • adding some functionality to our clean slate About Page;
  • methods of serialising POCOs to Application Settings.

1 thought on “Universal App Tutorials Part 12 : Universal App Reviews”

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