Mantenha tudo organizado com as coleções
Salve e categorize o conteúdo com base nas suas preferências.
Este guia descreve como integrar avaliações no app usando
Kotlin ou Java. Há guias de integração separados se você estiver usando código
nativo, Unity ou Unreal Engine.
Configurar seu ambiente de desenvolvimento
A Biblioteca Play In-App Review faz parte das Bibliotecas Google Play Core.
Inclua a seguinte dependência do Gradle para integrar a biblioteca Play In-App Review.
Groovy
// In your app's build.gradle file:...dependencies{// This dependency is downloaded from the Google's Maven repository.// So, make sure you also include that repository in your project's build.gradle file.implementation'com.google.android.play:review:2.0.2'// For Kotlin users also add the Kotlin extensions library for Play In-App Review:implementation'com.google.android.play:review-ktx:2.0.2'...}
Kotlin
// In your app's build.gradle.kts file:...dependencies{// This dependency is downloaded from the Google's Maven repository.// So, make sure you also include that repository in your project's build.gradle file.implementation("com.google.android.play:review:2.0.2")// For Kotlin users also import the Kotlin extensions library for Play In-App Review:implementation("com.google.android.play:review-ktx:2.0.2")...}
Criar o ReviewManager
O ReviewManager é a interface que permite ao app iniciar um fluxo de avaliação
no app. Ele pode ser acessado criando uma instância usando o
ReviewManagerFactory.
Siga as orientações sobre quando solicitar avaliações no app para determinar bons
pontos no fluxo do usuário (por exemplo,
quando o usuário conclui um nível em um jogo). Quando o app atingir um desses
pontos, use a instância ReviewManager para criar uma tarefa de solicitação. Se
for bem-sucedida, a API vai retornar o objeto ReviewInfo necessário para iniciar o
fluxo de avaliação no app.
Kotlin
valrequest=manager.requestReviewFlow()request.addOnCompleteListener{task->if(task.isSuccessful){// We got the ReviewInfo objectvalreviewInfo=task.result}else{// There was some problem, log or handle the error code.@ReviewErrorCodevalreviewErrorCode=(task.getException()asReviewException).errorCode}}
Java
ReviewManagermanager=ReviewManagerFactory.create(this);Task<ReviewInfo>request=manager.requestReviewFlow();request.addOnCompleteListener(task->{if(task.isSuccessful()){// We can get the ReviewInfo objectReviewInforeviewInfo=task.getResult();}else{// There was some problem, log or handle the error code.@ReviewErrorCodeintreviewErrorCode=((ReviewException)task.getException()).getErrorCode();}});
Iniciar o fluxo de avaliação no app
Use a instância ReviewInfo para iniciar o fluxo de avaliação no app. Aguarde até que
o usuário conclua o fluxo de avaliação no app antes de continuar com o
fluxo normal de usuários (como avançar para o próximo nível).
Kotlin
valflow=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.});
O conteúdo e os exemplos de código nesta página estão sujeitos às licenças descritas na Licença de conteúdo. Java e OpenJDK são marcas registradas da Oracle e/ou suas afiliadas.
Última atualização 2025-08-21 UTC.
[[["Fácil de entender","easyToUnderstand","thumb-up"],["Meu problema foi resolvido","solvedMyProblem","thumb-up"],["Outro","otherUp","thumb-up"]],[["Não contém as informações de que eu preciso","missingTheInformationINeed","thumb-down"],["Muito complicado / etapas demais","tooComplicatedTooManySteps","thumb-down"],["Desatualizado","outOfDate","thumb-down"],["Problema na tradução","translationIssue","thumb-down"],["Problema com as amostras / o código","samplesCodeIssue","thumb-down"],["Outro","otherDown","thumb-down"]],["Última atualização 2025-08-21 UTC."],[],[],null,["# Integrate in-app reviews (Kotlin or Java)\n\nThis guide describes how to integrate in-app reviews in your app using either\nKotlin or Java. There are separate integration guides if you are using [native\ncode](/guide/playcore/in-app-review/native), [Unity](/guide/playcore/in-app-review/unity) or [Unreal Engine](/guide/playcore/in-app-review/unreal-engine).\n\nSet up your development environment\n-----------------------------------\n\nThe Play In-App Review Library is a part of the [Google Play Core libraries](/guide/playcore).\nInclude the following Gradle dependency to integrate the Play In-App Review\nLibrary. \n\n### Groovy\n\n```groovy\n// In your app's build.gradle file:\n...\ndependencies {\n // This dependency is downloaded from the /studio/build/dependencies#google-maven.\n // So, make sure you also include that repository in your project's build.gradle file.\n implementation 'com.google.android.play:review:2.0.2'\n\n // For Kotlin users also add the Kotlin extensions library for Play In-App Review:\n implementation 'com.google.android.play:review-ktx:2.0.2'\n ...\n}\n```\n\n### Kotlin\n\n```kotlin\n// In your app's build.gradle.kts file:\n...\ndependencies {\n // This dependency is downloaded from the /studio/build/dependencies#google-maven.\n // So, make sure you also include that repository in your project's build.gradle file.\n implementation(\"com.google.android.play:review:2.0.2\")\n\n // For Kotlin users also import the Kotlin extensions library for Play In-App Review:\n implementation(\"com.google.android.play:review-ktx:2.0.2\")\n ...\n}\n```\n\nCreate the ReviewManager\n------------------------\n\nThe [`ReviewManager`](/reference/com/google/android/play/core/review/ReviewManager) is the interface that lets your app start an in-app\nreview flow. Obtain it by creating an instance using the\n[`ReviewManagerFactory`](/reference/com/google/android/play/core/review/ReviewManagerFactory). \n\n### Kotlin\n\n```kotlin\nval manager = ReviewManagerFactory.create(context)\n```\n\n### Java\n\n```java\nReviewManager manager = ReviewManagerFactory.create(context)\n```\n\nRequest a ReviewInfo object\n---------------------------\n\nFollow the guidance about [when to request in-app reviews](/guide/playcore/in-app-review#when-to-request) to determine good\npoints in your app's user flow to prompt the user for a review (for example,\nwhen the user completes a level in a game). When your app reaches one of these\npoints, use the [`ReviewManager`](/reference/com/google/android/play/core/review/ReviewManager) instance to create a request task. If\nsuccessful, the API returns the [`ReviewInfo`](/reference/com/google/android/play/core/review/ReviewInfo) object needed to start the\nin-app review flow. \n\n### Kotlin\n\n```kotlin\nval request = manager.requestReviewFlow()\nrequest.addOnCompleteListener { task -\u003e\n if (task.isSuccessful) {\n // We got the ReviewInfo object\n val reviewInfo = task.result\n } else {\n // There was some problem, log or handle the error code.\n @ReviewErrorCode val reviewErrorCode = (task.getException() as ReviewException).errorCode\n }\n}\n```\n\n### Java\n\n```java\nReviewManager manager = ReviewManagerFactory.create(this);\nTask\u003cReviewInfo\u003e request = manager.requestReviewFlow();\nrequest.addOnCompleteListener(task -\u003e {\n if (task.isSuccessful()) {\n // We can get the ReviewInfo object\n ReviewInfo reviewInfo = task.getResult();\n } else {\n // There was some problem, log or handle the error code.\n @ReviewErrorCode int reviewErrorCode = ((ReviewException) task.getException()).getErrorCode();\n }\n});\n```\n| **Note:** The [`ReviewInfo`](/reference/com/google/android/play/core/review/ReviewInfo) object is only valid for a limited amount of time. Your app should request a `ReviewInfo` object ahead of time (pre-cache) but only once you are certain that your app will launch the in-app review flow.\n\nLaunch the in-app review flow\n-----------------------------\n\nUse the [`ReviewInfo`](/reference/com/google/android/play/core/review/ReviewInfo) instance to launch the in-app review flow. Wait until\nthe user has completed the in-app review flow before your app continues its\nnormal user flow (such as advancing to the next level). \n\n### Kotlin\n\n```kotlin\nval flow = manager.launchReviewFlow(activity, reviewInfo)\nflow.addOnCompleteListener { _ -\u003e\n // The flow has finished. The API does not indicate whether the user\n // reviewed or not, or even whether the review dialog was shown. Thus, no\n // matter the result, we continue our app flow.\n}\n```\n\n### Java\n\n```java\nTask\u003cVoid\u003e flow = manager.launchReviewFlow(activity, reviewInfo);\nflow.addOnCompleteListener(task -\u003e {\n // The flow has finished. The API does not indicate whether the user\n // reviewed or not, or even whether the review dialog was shown. Thus, no\n // matter the result, we continue our app flow.\n});\n```\n| **Important:** If an error occurs during the in-app review flow, do not inform the user or change your app's normal user flow. Continue your app's normal user flow after `onComplete` is called.\n\nNext steps\n----------\n\n[Test your app's in-app review flow](/guide/playcore/in-app-review/test) to verify that your integration is\nworking correctly."]]