Google is committed to advancing racial equity for Black communities. See how.

Integrate in-app reviews (Kotlin or Java)

This guide describes how to integrate in-app reviews in your app using either Kotlin or Java. There are separate integration guides if you are using native code or Unity.

Set up your development environment

The In-App Review API is a part of the Play Core SDK. To set up your development environment, follow the setup instructions in the Java or Kotlin section of the Play Core library guide.

Create the ReviewManager

The ReviewManager is the interface that lets your app start an in-app review flow. Obtain it by creating an instance using the ReviewManagerFactory.

Kotlin

val manager = ReviewManagerFactory.create(context)

Java

ReviewManager manager = ReviewManagerFactory.create(context)

Request a ReviewInfo object

Follow the guidance about when to request in-app reviews to determine good points in your app's user flow to prompt the user for a review (for example, when the user completes a level in a game). When your app reaches one of these points, use the ReviewManager instance to create a request task. If successful, the API returns the ReviewInfo object needed to start the in-app review flow.

Kotlin

val request = manager.requestReviewFlow()
request.addOnCompleteListener { request ->
    if (request.isSuccessful) {
        // We got the ReviewInfo object
        val reviewInfo = request.result
    } else {
        // There was some problem, continue regardless of the result.
    }
}

Java

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.
    }
});

Launch the in-app review flow

Use the ReviewInfo instance to launch the in-app review flow. Wait until the user has completed the in-app review flow before your app continues its normal user flow (such as advancing to the next level).

Kotlin

val flow = manager.launchReviewFlow(activity, reviewInfo)
flow.addOnCompleteListener { _ ->
    // 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.
}

Java

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.
});

Next steps

Test your app's in-app review flow to verify that your integration is working correctly.