Implementing In-App Reviews Using Google Play Review API

Daniel Atitienei
3 min readSep 19, 2023

Hey! Take your coffee ☕ and see how to implement the in-app review functionality using the API provided by Google Play.

Setup

The first thing is to add the dependency for this feature. So, go ahead and open the :app/build.gradle.kts and add this dependency.

dependencies {
implementation("com.google.android.play:review-ktx:2.0.1")
}

requestReview

We don’t have to write so much code, so let’s start creating the requestReview function in the MainActivity.kt.

First of all, we need to create an instance of the ReviewManager. This allows us to start a request review flow.

private fun requestReview() {
val manager = ReviewManagerFactory.create(applicationContext)
}

To create the request we need to call manager.requestReviewFlow() function. I prefer to store it in a variable to make the code much cleaner.

val request = manager.requestReviewFlow()

Now all we have to do is to listen to the changes and if the request response is successful we can launch the review flow.

request.addOnCompleteListener { task ->
if (task.isSuccessful) {…

--

--