Introducing In-App Rating for Avalonia Apps

Published on

For anyone developing Android and iOS apps, getting feedback from users is crucial for improving your app and improving its visiblity...

Introducing Jc.AppRating.Avalonia

Jc.AppRating.Avalonia provides a simple way to implement in-app rating functionality.

The source code and the latest documentation is available on GitHub at jcsawyer/Jc.AppRating.Avalonia.

Getting Started

To use Jc.AppRating.Avalonia you must add the Jc.AppRating.Avalonia package to your cross-platform project.

dotnet add package Jc.AppRating.Avalonia

Followed by adding the Android/iOS Jc.AppRating.Avalonia.xxx package to the platform specific project(s).

dotnet add package Jc.AppRating.Avalonia.Android
dotnet add package Jc.AppRating.Avalonia.iOS

Then you must register AppRating in the CustomizeAppBuilder method in MainActivity.cs and AppDelegate.cs for Android and iOS respectively:

protected override AppBuilder CustomizeAppBuilder(AppBuilder builder)
{
    return base.CustomizeAppBuilder(builder)
        ...
        .UseAppRating();
}

Finally, you can access the methods like so:

// Subscribe to error events (when either method fails to execute)
AppRating.Current.OnError += (sender, error)
          => Console.WriteLine(error.Message);

// Open an in-app rating dialog
AppRating.Current.RequestInAppRatingAsync();
// Open the respective store app on the rating page
AppRating.Current.RequestInStoreRatingAsync("appId");