Google Play In-App Review API
The Google Play In-App Review API lets the user submit ratings and reviews for your application or game. Until now we have to use the traditional way of rating the application by going directly to the app on play store, by email, etc. As we already know the rating plays a bigger role for users to choose the higher rating app or game. Here comes the part where we use Google Play In-App Review API so that the user can provide their feedback experienced while the application.
Generally, the in-app review flow can be triggered at any time throughout the user journey of your app. During the flow, the user has the ability to rate your app using the 1 to the 5-star system and to add an optional comment. Once submitted, the review is sent to the Play Store and eventually displayed.
To protect user privacy and avoid API misuse, there are strict guidelines that your app should follow about when to request in-app reviews and the design of the review prompt.
Some of the quota and design guidelines for In-App review API
When the user has experienced your application or game then in-app review flow should be used so that the user can provide useful feedback. Try not to prompt the user excessively to provide a review.
You have to show the Review card as it is, you should not have to change the design. Any overlay should not be added on top or around the card.
Google Play enforces a quota on how often a user can be shown the review dialog to provide a review for the application. The review card should not be programmatically removed, it will automatically be removed based on user actions or by internal play store mechanism.
Let’s start implementing the In-App review code
Android devices should be running on Android 5.0 (API level 21) or higher and should have Google play store installed. Play the core library with v1.8.0 or higher. Add a play-core library as a dependency in your build.gradle file.
1 |
implementation 'com.google.android.play:core:1.8.0' |
Create a ReviewManager instance and request for the ReviewInfo object. The ReviewInfo object is only valid for a limited amount of time. Your app should request a ReviewInfo object ahead of time (pre-cache) but only once you are certain that your app will launch the in-app review flow.
1 2 3 4 5 6 7 8 9 10 11 12 13 |
private var reviewInfo: ReviewInfo? = null private lateinit var reviewManager: ReviewManager val requestFlow = reviewManager.requestReviewFlow() requestFlow.addOnCompleteListener { request -> reviewInfo = if (request.isSuccessful) { //Received ReviewInfo object request.result } else { //Some Problem occurred null } } |
Now we have to use the ReviewInfo instance to launch the in-app review flow. It best to show the review card when the user has experienced enough of your application.
1 2 3 4 5 6 7 8 |
reviewInfo?.let { val flow = reviewManager.launchReviewFlow(this@HomeActivity, it) flow.addOnSuccessListener { // The flow has completed but the he API does not mean if the user reviewed or not, or even whether the review dialog was shown. Thus, no matter the result the app code must continue. } } |
How to test
The application must be released on the play store to provide a review or you can use internal app sharing. If you have given feedback that is already given then, the in-app review card will not show the Review card it will trigger a success event directly. While calling a review card flow it might not always a dialog because of the quota limit per user. The review card flow should not be linked with any button click event. To check other design guidelines and when to display a review card, refer to the official document here. That’s it for today for my side.