Android In-App Review API Integration — Ship Repair Man Story

Alok Bharti
Published in
3 min readAug 18, 2020


Have you heard of a story in which an old man fixes a ship engine by just tapping with a hammer? Well, if not then you can read it here.

There is a beautiful quote mentioned in the story:

“Effort is important, but knowing where to make an effort makes all the difference!”

Okay, let’s discuss how this is related to our discussion.

So, the android team recently announced in-app review API and its integration is quite simple. You just have to add a dependency in your app-level gradle file:

implementation ''

And, add this code to launch the review process:

val manager = ReviewManagerFactory.create(context)
var reviewInfo: ReviewInfo
manager.requestReviewFlow().addOnCompleteListener{request ->
reviewInfo = request.result

//success app review, go with the flow
//launching failed

That’s it. See, how simple it is. But wait, there are some important things that we should take care of while implementing it. You can call this only a few times a year (not exactly mentioned in the documentation but since apple allows only 3 times a year, I guess it should be 5–6 in android). Well, you don’t want to irritate your user by asking them to review every time they open your app. Either they will skip it or give a bad review.

So, can you relate the ship repairman story here? Well, now you’ve to decide how to use it efficiently such that you’ll only ask a user to review your app only they have used your app enough.

Okay, let me give you an example of how I implemented it in one of my apps, DailyNews. As the name suggests, it’s a news app and a user can bookmark any article they like. So, most probably they’ll bookmark an article if they like it too much otherwise they also have an option to read the entire article if they’re “just” interested. So, I added two conditions in my code where all the bookmarked articles are displayed:

  1. The number of bookmarked articles should be more than 20. This will ensure that the user has interacted enough with the app.
  2. And, the minimum difference between the current timestamp and the last timestamp when the review was asked should be greater than 30 days(except for the first time).
In-app review dialog

See, integration is easy but how and where to integrate is hard to decide.

Besides, if you want to test it before releasing your app into the production then there are two ways to do so.

  1. Replace the ReviewManagerFactory.create(context) by FakeReviewManager(context) . And then you can see the results in the callback of the requestReviewFlow listeners. But you’ll not see any dialog or anything by doing this. It’ll only give you the response in the callbacks.
  2. To see how it actually works with the review layout, release it into your one of the testing track in Google play console and then download it on your mobile. But make sure you had not given any review before for this app from your current google account. Your review will be submitted by the account with which the you’ve logged into google play.

Hope you learned something from this article and if you did, then you can clap or share it on your social media handles(Fun Fact: You can clap up to 50 times on an article). And you can connect with me on LinkedIn or Twitter. Also, feel free to share your feedback in comments.

Happy Coding! Peace out✌

We are trying to fix some broken benches in the Indian agriculture ecosystem through technology, to improve farmers’ income. If you share the same passion join us in the pursuit, or simply drop us a line on

Follow Tech@Carnot for more such blogs on topics like Data Science and Visualization, Cloud Engineering, Firmware Development, and many more.