"Rate this app" functionality using In-App Review API
Requesting a Play Store user review for your Android app is one of the most effective ways of getting more reviews/ratings. Until now this was usually implemented by informing the user about your desire to receive a review and then launching Play Store to your app's listing page.
This was not the best experience. A user leaving your app is (almost) never your intention. The experience of leaving your app, launching another app, and then return is not ideal. Also, the possibility that the user might get distracted in Play Store and forget to return to your app was quite real.
Fortunately, now there's an API that allows you to show discrete in-app pop-ups to urge users to rate (or review). The user will not have to leave your app. This is available for Android 5.0 (API level 21) devices or above with Play Store installed (obviously).
When to show the popup
There are some (quite reasonable in my opinion) guidelines on when you should show the pop-up. In short:
- the user must have spent some "reasonable" time in the app to form an opinion
- not to spam the user with review requests
- not influencing the user in any way before or during the review process (e.g. asking whether they enjoy the app before asking for a review)
Check out the official doc since this is a sensitive guideline that needs to be respected.
Set up
Slightly modify your build.gradle
to include the Play Core library:
Check out the official doc for the latest versions.
Usage
It's super easy to make the review request pop-up to appear. There are just a few points that you need to know.
val manager = ReviewManagerFactory.create(context) // [1]
val request = manager.requestReviewFlow()
request.addOnCompleteListener { request ->
if (request.isSuccessful) {
val reviewInfo = request.result // [2]
val flow = manager.launchReviewFlow(activity, reviewInfo) [3]
flow.addOnCompleteListener { _ ->
// [4]
}
} else {
// [5]
}
}
ReviewManager
is the main interface for interacting with the in-app review flow.- You need a
ReviewInfo
to show the pop-up. Note here that this object is valid for a limited time. So you should not get this way before you intend to show the pop-up because it might expire. - This is what shows the pop up. Note that this does not guarantee that the pop-up will be shown. If the requirements are met (e.g. the user has not already reviewed the app) and there is a quota, then the dialog will be shown.
- When this point is reached it means that the review request process has finished. You can resume your app functionality. It does not mean that the dialog was shown or the user reviewed the app. Just that the review request flow is finished (e.g. the user might have chosen not to review the app).
- In case there's an issue when asking for a review request, resume the app functionality. No need to show an error message since this action is "optional" anyway.
Testing
To manually test the flow you would need to use a Play Console test track (and not have reviewed the app already). Additionally, for unit/integration tests a fake implementation is provided.
Hopefully, I've explained clearly and concisely about the new in-app review API. Happy review requests! :)