Improve your Apps Ranking – Get it Rated
Assuming you have a great app name and tile. Oh and the app is useful and bug free (got a bit of work to do?). Then you need to make sure people rate your app. Sometimes your users need a friendly reminder. Not too many or you risk annoying them.
TL;DR
Using NuGet in Visual Studio:
Install-Package ReviewNotifier
In your app:
private async void Application_Launching(object sender, LaunchingEventArgs e)
{
await ReviewNotification.InitializeAsync();
// Rest of your Application_Launching method
...
}
When you want to show the notification:
ReviewNotification.TriggerAsync("Message", "Title", "OK", "Cancel");
Check out the blog post of the above NuGet package author. It works in Windows Phone as well!
A Little More Guidance
Before starting down the path of asking the user to rate your app we should make sure we have an Internet connection otherwise they wont be able to access the Store to complete their review.
Here is a bulletproof way to check for Internet access (courtesy of Kasper Holdum):
public static bool IsConnected
{
get
{
var profiles = NetworkInformation.GetConnectionProfiles();
var internetProfile = NetworkInformation.GetInternetConnectionProfile();
return profiles.Any(s => s.GetNetworkConnectivityLevel() == NetworkConnectivityLevel.InternetAccess)
|| (internetProfile != null
&& internetProfile.GetNetworkConnectivityLevel() == NetworkConnectivityLevel.InternetAccess);
}
}
Now that we know the user can actually complete the process lets see if they have not done so already (I guess you could do this before checking for connectivity).
ApplicationDataContainer _roamingData = ApplicationData.Current.RoamingSettings;
private bool AppRatingSetting()
{
if (_roamingData.Values["AppRatingDone"] != null)
return (bool)_roamingData.Values["AppRatingDone"];
return false;
}
Saving the fact that the App has been rated is simply a matter of giving the setting a value. I am choosing to use the roaming settings in case the user has installed the app on other devices – really don’t want to annoy your users.
private void SaveAppRatingSetting()
{
_roamingData.Values["AppRatingDone"] = true;
}
And here is the code to launch the IE and take you to the app rating section for your app. Don’t forget to change the values stored in appName and appStoreId.
private async Task AskForAppRating()
{
_roamingData.Values["AppRatingDone"] = null;
if (!IsConnected)
return;
if (ReadAppRatingSetting())
return;
var appName = "Your App Name";
var msg = new MessageDialog("Help us help you. Would you like to rate & review " + appName + "?");
msg.Commands.Add(new UICommand("Rate", new UICommandInvokedHandler(this.OpenStoreRating)));
msg.Commands.Add(new UICommand("Not now", (uiCommand) => { }));
msg.Commands.Add(new UICommand("No, thanks", new UICommandInvokedHandler(this.IgnoreRating)));
msg.DefaultCommandIndex = 0;
msg.CancelCommandIndex = 1;
await msg.ShowAsync();
}
private void IgnoreRating(IUICommand command)
{
SaveAppRatingSetting();
}
private async void OpenStoreRating(IUICommand command)
{
var appStoreId = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx";
await Windows.System.Launcher.LaunchUriAsync(new Uri("ms-windows-store:REVIEW?PFN=" + appStoreId));
SaveAppRatingSetting();
}