In-App Review for Android (Java)

Recently our app rate is low so the business team has tried to in-app review for iOS and after 3 months the rate has been increased from 2.5 to 3.5 for 2 months. So it is so great, right? so in this article, we will implement in-app review for Android.

Edit 2020/12/07

After a week release in-app review we got the rating star from 2.3 -> 3.6 it is unbelievable

Edit 2020/12/10

Our app rating now is 4.2

  1. What is an in-app review and why?

Firstly let's check the google official document

2. Something you should notice before to start

  • Your app should not ask the user any questions before or while presenting the rating button or card, including questions about their opinion (such as “Do you like the app?”) or predictive questions (such as “Would you rate this app 5 stars”).

So basically you should not ask users any questions before to show rating button or card if you want to ask users don't user in-app review instead of you can direct users to google play console.

For example, you should not have a call-to-action option (such as a button) to trigger the API, as a user might have already hit their quota and the flow won’t be shown, presenting a broken experience to the user. For this use case, redirect the user to the Play Store instead.

3. How to implementation

  1. Add google play core SDK library to the gradle file (app level)
implementation 'com.google.android.play:core:1.8.2'

2. Create the ReviewManager

ReviewManager manager = ReviewManagerFactory.create(this);

‘this’ is a current activity context, you can use this or ActivityName.this

3. Request a reviewInfor object

This is just a request review info only, you can initiate this object from the beginning of start the activity.

ReviewManager manager = ReviewManagerFactory.create(this);
Task<ReviewInfo> request = manager.requestReviewFlow();
request.addOnCompleteListener(task -> {
if (task.isSuccessful()) {
// We can get the ReviewInfo object
ReviewInfo reviewInfo = task.getResult();
} else {
// There was some problem, continue regardless of the result.
}
});

4. Launch the in-app review flow

This is the action to show in-app review dialog

Task<Void> flow = manager.launchReviewFlow(activity, reviewInfo);
flow.addOnCompleteListener(task -> {
// The flow has finished. The API does not indicate whether the user
// reviewed or not, or even whether the review dialog was shown. Thus, no
// matter the result, we continue our app flow.
});

5. Example case

Please change YOURACTIVITY as your app activity

ReviewManager manager;
private ReviewInfo reviewInfo;
manager = ReviewManagerFactory.create(this);

Task<ReviewInfo> request = manager.requestReviewFlow();
request.addOnCompleteListener(task -> {
if (task.isSuccessful()) {
reviewInfo = task.getResult();
Task<Void> flow = manager.launchReviewFlow(YOURACTIVITY.this, reviewInfo);
flow.addOnCompleteListener(taskdone -> {
// This is the next follow of your app
});
}
});
// other action, please DO NOT add any flow after Task because i will run parawell, you must to add in addOnCompleteListener

6. Please Note

Please note that if in your activity have any methods, it will run parallel with the review, for example, you direct the page to other activity, you will lose the request review.

7. How to Test

https://developer.android.com/guide/playcore/in-app-review/test

Yeah, it is quite difficult for testing, you must release the app to Internal Testing

And next, you have to delete your current review in the google play store. If you want to test again, you must delete the review again. Sometimes you cannot delete the review, you should EDIT the review and then you can delete your review.