Rate Us Dialog

This guide show's how to make a common Rate Us Dialog with the Native Dialogs API.

In the example below we not only will create a dialog with 3 buttons bit also set up a listener to redirect a user to the marked to allow him to rate our app.

Please note that there is no way to get a callback if the user sets a rating to your app or now. You also should not reward a user based on his decision to rate your app or not. This is maybe a reason for Google to restrict your application in the market.

See the code snippet below:

using SA.Android.App;
using SA.Android.Content;
...

string appName = Application.productName;
string appIdentifier = Application.identifier;

var dialog = new AN_AlertDialog(AN_DialogTheme.Default);
dialog.Title = string.Format("Rate {0}!", appName);
dialog.Message = string.Format("If you enjoy using {0}, please take a moment to rate it.Thanks for your support!", appName);

dialog.SetNegativeButton("No, thanks", () => {
    AN_Logger.Log("dialog: No, thanks button was clicked");
});

dialog.SetNeutralButton("Remind me later", () => {
    AN_Logger.Log("dialog: Remind me later button was clicked");
});

dialog.SetPositiveButton("Rate", () => {
    AN_Logger.Log("dialog: Rate button was clicked");

    //This code will take user to your app Play Market page
    System.Uri uri = new System.Uri("market://details?id=" + appIdentifier);
    AN_Intent viewIntent = new AN_Intent(AN_Intent.ACTION_VIEW, uri);
    AN_MainActivity.Instance.StartActivity(viewIntent);
});

dialog.Show();