{"id":13692192,"url":"https://github.com/FabriBertani/Plugin.Maui.AppRating","last_synced_at":"2025-05-02T19:31:39.628Z","repository":{"id":153279006,"uuid":"628202706","full_name":"FabriBertani/Plugin.Maui.AppRating","owner":"FabriBertani","description":"An easy way to quickly add store rating reviews to your .Net MAUI app. ","archived":false,"fork":false,"pushed_at":"2025-01-21T02:16:23.000Z","size":507,"stargazers_count":70,"open_issues_count":2,"forks_count":4,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-22T17:58:30.351Z","etag":null,"topics":["android","ios","maui","mobile","rating","review"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/FabriBertani.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-04-15T08:04:16.000Z","updated_at":"2025-03-23T23:15:50.000Z","dependencies_parsed_at":null,"dependency_job_id":"4d320338-07f9-42b9-813a-333ccb3143d5","html_url":"https://github.com/FabriBertani/Plugin.Maui.AppRating","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FabriBertani%2FPlugin.Maui.AppRating","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FabriBertani%2FPlugin.Maui.AppRating/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FabriBertani%2FPlugin.Maui.AppRating/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FabriBertani%2FPlugin.Maui.AppRating/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/FabriBertani","download_url":"https://codeload.github.com/FabriBertani/Plugin.Maui.AppRating/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252095243,"owners_count":21693884,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","ios","maui","mobile","rating","review"],"created_at":"2024-08-02T17:00:54.679Z","updated_at":"2025-05-02T19:31:39.622Z","avatar_url":"https://github.com/FabriBertani.png","language":"C#","funding_links":[],"categories":["Plugins"],"sub_categories":[],"readme":"# Plugin.Maui.AppRating\n[![NuGet](https://img.shields.io/nuget/v/Plugin.Maui.AppRating.svg?label=NuGet)](https://www.nuget.org/packages/Plugin.Maui.AppRating/)\n\n`Plugin.Maui.AppRating` gives developers a fast and easy way to ask users to rate the app on the stores.\n\n## Platforms supported\n\n|Platform|Version|\n|-------------------|:------------------:|\n|.Net MAUI Android|API 21+|\n|.Net MAUI iOS|iOS 12.2+|\n|Windows|10.0.17763+|\n|Mac Catalyst|15.0+|\n\n## Installation\n`Plugin.Maui.AppRating` is available via NuGet, grab the latest package and install it in your solution:\n\n    Install-Package Plugin.Maui.AppRating\n\nIn your `MauiProgram` class add the following using statement:\n\n```csharp\nusing Plugin.Maui.AppRating;\n```\n\nFinally, add the default instance of the plugin as a singleton to inject it in your code late:\n\n```csharp\nbuilder.Services.AddSingleton\u003cIAppRating\u003e(AppRating.Default);\n```\n\n## Version 1.2.1\n### New Features\n- Removed .Net7 support.\n- Added .Net9 support to all platforms.\n- Replaced the old `Xamarin.Google.Android.Play.Core` package with the modern `Xamarin.Google.Android.Play.Review.Ktx` package that also supports .Net9, on Android.\n\n## :warning: Considerations regarding new platform policies :warning:\n### Android\n- It's highly recommended to test this or any other store review plugin on a real device with Google Play installed instead of using an emulator.\n- Due to new regulations from Google, the review dialogue will not be displayed on manual distribution or debug mode (apparently), only on apps published and distributed via Google Play Store, however, it is recommended to release your app under \"Internal distribution\" or \"Internal App Sharing\" to effectively test the store review popup. [Read here for more information](https://developer.android.com/guide/playcore/in-app-review/test). Additionally, you can debug the error using `adb logcat`.\n- `FakeReviewManager` is a new feature released by Google, primarily designed for testing and unit testing purposes. It operates without a user interface (UI). For more information, visit the [official Android documentation](https://developer.android.com/reference/com/google/android/play/core/review/testing/FakeReviewManager).\n- To integrate `FakeReviewManager` in your implementation of this plugin, pass `true` to the method `PerformInAppRateAsync`. This feature is exclusive to Android.\n\n### iOS\n- During development, submitting a review is not possible, but the review popup dialog will still show on your simulator or device.\n- :warning: The review dialogue **_will not be opened_** if the app is downloaded from TestFlight.\n\n## API Usage\nCall the injected interface in any page or viewmodel to gain access to the APIs.\n\nThere are two main methods in the plugin: `PerformInAppRateAsync` and `PerformRatingOnStoreAsync`.\n\n### Android\n```csharp\n/// \u003csummary\u003e\n/// Perform rating without leaving the app.\n/// \u003c/summary\u003e\nTask PerformInAppRateAsync(bool isTestOrDebugMode = false);\n```\n\u003e This method will open an in-app review dialogue, using the `packageName` declared on the `AndroidManifest` file.\n\n```csharp\n/// \u003csummary\u003e\n/// Perform rating on the current OS store app or open the store page on the browser.\n/// \u003c/summary\u003e\nTask PerformRatingOnStoreAsync();\n```\n\u003e This method will open the **_Google Play app_** on the store page of your current application. Otherwise, it will try to open the store page on the browser.\n\nIf neither the store page nor the browser store page works, it will display an alert announcing the error.\n\n`packageName` **must** be provided as a named argument to open the store page on the store app or browser.\n\n#### Example\n```csharp\nawait _appRating.PerformRatingOnStoreAsync(packageName: \"com.instagram.android\");\n```\n\n### iOS | Mac Catalyst\n```csharp\n/// \u003csummary\u003e\n/// Perform rating without leaving the app.\n/// \u003c/summary\u003e\nTask PerformInAppRateAsync();\n```\n\u003e if the device current OS version is _10.3+_ in **iOS**, or _14.0+_ in **Mac Catalyst**, this method will raise an in-app review popup of your current application, otherwise, it will display an alert announcing that it's not supported.\n\n```csharp\n/// \u003csummary\u003e\n/// Perform rating on the current OS store app or open the store page on the browser.\n/// \u003c/summary\u003e\nTask PerformRatingOnStoreAsync();\n```\n\u003e This method will open the **App Store app** on the store page of your current application. Otherwise, it will try to open the store page on the browser.\n\nIf the method fails, it will display an alert announcing the error.\n\n`applicationId` property is the **_StoreId_** of your application and it **must** be provided as a named argument to open the store page on the store app or browser.\n\n#### Example\n```csharp\nawait _appRating.PerformRatingOnStoreAsync(applicationId: \"id389801252\");\n```\n\n### Windows\n```csharp\n/// \u003csummary\u003e\n/// Perform rating without leaving the app.\n/// \u003c/summary\u003e\nTask PerformInAppRateAsync();\n```\n\u003e This method will raise an in-app review dialog of your current application, otherwise, it will display an alert announcing that it's not supported.\n\n```csharp\n/// \u003csummary\u003e\n/// Perform rating on the current OS store app or open the store page on the browser.\n/// \u003c/summary\u003e\nTask PerformRatingOnStoreAsync();\n```\n\u003e This method will open the **_Microsoft Store application_** on the store page of your current application. Otherwise, it will try to open the store page on the browser.\n\nIf this method fails, it will display an alert announcing the error.\n\n`productId` property is the **ProductId** of your application and it **must** be provided as a named argument to open the store page on the store app or browser.\n\nExample\n```csharp\nawait _appRating.PerformRatingOnStoreAsync(productId: \"9nblggh5l9xt\");\n```\n\n## Usage\n\u003e :warning: **Warning** - You should be careful about **how and when** you ask users to rate your app, there may be penalties from stores. As for advice, I recommend using a counter on the app start and storage that count, then when the counter reaches a specific number, display a dialogue asking the users if they want to rate the app, if they decline the offer, reset the counter to ask them later, also leave the option to do it themselves.\n\n```csharp\npublic partial class MainPage : ContentPage\n{\n    private readonly IAppRating _appRating;\n\n    // We are using the Instagram application as an example here\n    private const string androidPackageName = \"com.instagram.android\";\n    private const string iOSApplicationId = \"id389801252\";\n    private const string windowsProductId = \"9nblggh5l9xt\";\n\n    public MainPage(IAppRating appRating)\n    {\n        InitializeComponent();\n\n        _appRating = appRating;\n\n        if (!Preferences.Get(\"application_rated\", false))\n            Task.Run(() =\u003e CheckAppCountAndRate());\n    }\n\n    private async Task CheckAppCountAndRate()\n    {\n        if (Preferences.Get(\"application_counter\",0) \u003e= 5)\n        {\n            if (!await DisplayAlert(\"Rate this App!\", \"Are you enjoying the so far? Would you like to leave a review in the store?\", \"Yes\", \"No\"))\n            {\n                Preferences.Set(\"application_counter\", 0);\n\n                return;\n            }\n\n            await RateApplicationInApp();\n        }\n    }\n\n    private Task RateApplicationInApp()\n    {\n        Dispatcher.Dispatch(async () =\u003e\n        {\n# if DEBUG\n            await _appRating.PerformInAppRateAsync(true);\n#else\n            await _appRating.PerformInAppRateAsync();\n#endif\n        });\n\n        Preferences.Set(\"application_rated\", true);\n\n        return Task.CompletedTask;\n    }\n\n    private Task RateApplicationOnStore()\n    {\n        Dispatcher.Dispatch(async () =\u003e\n        {\n            await _appRating.PerformRatingOnStoreAsync(packageName: androidPackageName, applicationId: iOSApplicationId, productId: windowsProductId);\n        });\n\n        Preferences.Set(\"application_rated\", true);\n\n        return Task.CompletedTask;\n    }\n\n    private void InAppRating_Clicked(object sender, EventArgs e)\n    {\n        Task.Run(RateApplicationInApp);\n    }\n\n    private void AppRateOnStore_Clicked(object sender, EventArgs e)\n    {\n        if (!Preferences.Get(\"application_rated\", false))\n            Task.Run(RateApplicationOnStore);\n    }\n}\n```\n\n## Sample\nTake a look at the [AppRatingSample](https://github.com/FabriBertani/Plugin.Maui.AppRating/tree/main/samples/AppRatingSample) for a fully detailed implementation of this plugin.\n\n## Contributions\nPlease, feel free to open an [Issue](https://github.com/FabriBertani/Plugin.Maui.AppRating/issues) if you find any bugs or submit a PR.\n\n## License\nPlugin.Maui.AppRating is licensed under [MIT](https://github.com/FabriBertani/Plugin.Maui.AppRating/blob/main/LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FFabriBertani%2FPlugin.Maui.AppRating","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FFabriBertani%2FPlugin.Maui.AppRating","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FFabriBertani%2FPlugin.Maui.AppRating/lists"}