A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
Hello @Kim Strasser ,
Thanks for your question.
Since you are building your game with .NET MAUI, Google's official In-App Review docs don't cover MAUI directly. Therefore, I recommend using the community-created Plugin.Maui.AppRating, which has gained over 57,000 downloads.
For more information, you can refer to to this usage and code example.
- Install the nuget package
dotnet add package Plugin.Maui.AppRating
- Register in
MauiProgram.cs
using Plugin.Maui.AppRating;
public static class MauiProgram
{
public static MauiApp CreateMauiApp()
{
var builder = MauiApp.CreateBuilder();
builder
.UseMauiApp<App>()
.ConfigureFonts(fonts =>
{
fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
fonts.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold");
});
builder.Services.AddTransient<MainPage>();
builder.Services.AddSingleton<IAppRating>(AppRating.Default);
return builder.Build();
}
}
- Code example in your game page
using Plugin.Maui.AppRating;
public partial class GamePage : ContentPage
{
private readonly IAppRating _appRating;
private const string AndroidPackageName = "com.yourcompany.yourgame";
private const string IOSApplicationId = "idYOURAPPID";
public GamePage(IAppRating appRating)
{
InitializeComponent();
_appRating = appRating;
_appRating.ThrowErrors = false;
}
public async Task OnLevelCompleted()
{
int levelsCompleted = Preferences.Get("levels_completed", 0) + 1;
Preferences.Set("levels_completed", levelsCompleted);
if (levelsCompleted % 5 == 0)
{
await CheckAndShowReviewPrompt();
}
}
private async Task CheckAndShowReviewPrompt()
{
if (Preferences.Get("app_rated", false))
return;
var lastShownStr = Preferences.Get("last_review_shown", string.Empty);
if (!string.IsNullOrEmpty(lastShownStr))
{
var lastShown = DateTime.Parse(lastShownStr);
var daysPassed = (DateTime.UtcNow - lastShown).TotalDays;
if (daysPassed < 30)
return;
}
await MainThread.InvokeOnMainThreadAsync(async () =>
{
bool wantsToRate = await DisplayAlert(
"Enjoying the game? ",
"Would you like to leave a quick review? It really helps us!",
"Sure!", "Maybe later"
);
if (!wantsToRate)
{
Preferences.Set("levels_completed", 0);
return;
}
await ShowNativeReviewPopup();
});
}
private async Task ShowNativeReviewPopup()
{
await MainThread.InvokeOnMainThreadAsync(async () =>
{
#if DEBUG
await _appRating.PerformInAppRateAsync(isTestOrDebugMode: true);
#else
await _appRating.PerformInAppRateAsync();
#endif
});
Preferences.Set("last_review_shown", DateTime.UtcNow.ToString());
Preferences.Set("app_rated", true);
}
private async void OnRateUsButtonClicked(object sender, EventArgs e)
{
if (Preferences.Get("app_rated", false))
return;
await MainThread.InvokeOnMainThreadAsync(async () =>
{
try
{
await _appRating.PerformRatingOnStoreAsync(
packageName: AndroidPackageName,
applicationId: IOSApplicationId
);
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine($"Rating error: {ex.Message}");
}
});
Preferences.Set("app_rated", true);
}
}
How can I display the prompt in my game after finishing a level?
When the player finishes a level, you call OnLevelCompleted(). The code above then:
- Counts how many levels they've completed (stored locally on device)
- Only considers showing the prompt every 5 levels
- Checks your own timing rules (30-day interval)
- Then calls
PerformInAppRateAsync()which shows the native Google Play popup right inside your game - the player never leaves your app.
Is it necessary that I check if the prompt was already displayed three times in a 365-day period like on iOS or is this different on Android
On Android, you do not need to check or count how many times the popup has been shown. Google enforces a quota automatically and secretly. Here's what Google officially says:
"Google Play enforces a time-bound quota on how often a user can be shown the review dialog. The specific value of the quota is an implementation detail and it can be changed by Google Play without any notice."
Is it necessary to check if the user has already added a rating or a review?
No, and it is actually impossible to check this. Neither Google nor Apple tells your app whether the user actually submitted a rating. This is intentional to protect user privacy.
Should I store timestamps on a server?
If your player has an account and plays on their Android phone and their iPad, the two devices don't know about each other's local storage. In that case, I recommend storing the last_review_shown timestamp on your server tied to the user's account. But honestly, even in this case - both Google and Apple already silently limit how often the native popup actually appears, so the real-world impact is low.
Note:
- Do not run the app in debug mode
- Run on real devices
While these links are non-Microsoft links, they are official Github, Nuget and Android documentations and are safe to visit.
I hope this addresses your question. If this response was helpful, please consider following the guidance to provide feedback.