Skip to main content

Show in-app rating (ShowRatingAlert)

AndroidiOS
If you are using Unreal Engine, see ShowRatingAlert for Unreal Engine SDK.

Show in-app rating.

info
  • The debug version cannot submit a rating, while the release version can.
  • Under normal circumstances, the debug version can pop up the rating dialog as a functionality check.

Android Quota Limitation Explanation:

The Google Play official limit stipulates that frequent calls to the rating interface in a short time may not always display the dialog box.

For more information, see Google Play In-App Review API.

iOS Quota Limitation Explanation:

If the user has not yet rated or reviewed your application on this device, StoreKit will show the rating and review request up to three times within 365 days.
If the user has already rated or reviewed your application on this device, StoreKit will show the rating and review request if the application version is new, and more than 365 days have passed since the user's last review.

For more information, see iOS Rating Mechanism.

note

如果未正确集成Google Play Core库的Review API组件(play-core或play-review),将会导致运行时无法加载相关类。

  • ClassNotFoundException: com.google.android.play.core.review.ReviewManagerFactory
  • ClassNotFoundException: com.google.android.play.core.review.ReviewManager
  • ClassNotFoundException: com.google.android.play.core.tasks.OnCompleteListener

To avoid conflicts with Google's business self-integration libraries, the platform layer has removed the Google dependency libraries. It is now up to businesses to import them as needed.
1. Add dependency
You can add the following in your module's APL.xml:

<buildGradleAdditions>
<insert>
dependencies {
implementation 'com.google.android.play:review:2.0.0'
}
</insert>
</buildGradleAdditions>

2. Proguard rules (required for release versions)
In the <proguardAdditions> section of INTLCore_APL.xml, add the following content to prevent issues caused by reflection obfuscation:

# ShowRatingAlert requires excluding obfuscation for play-core and review libraries to ensure reflection works
-keep class com.google.android.play.core.review.** {*;}
-keep class com.google.android.play.core.tasks.** {*;}
-keep class com.google.android.gms.tasks.** {*;}

Function Definition

void ShowRatingAlert();

Code Example

UnionAdapterAPI.GetToolsService().ShowRatingAlert();