Image from

In-App Review Android

2 Mins read

We are waiting & hoping this for a long time and finally, the Android team released it on August 05 2020.

Google-Android released In-App review API and now android users able to give the review to our application without re-direct to Google Play application. User’s review is the most important thing for the application developer or a company because it helps us in application enhancement and improvement.

User reviews are valuable part for application development and due to previous functionality to give the review to an application we all are losing lots of reviews because every application user doesn’t want the interruption while they are playing a game or chatting or doing anything in the application, they just want the smooth user experience this interruption leads us to miss out many reviews.

In-App Review API

The in-app review API supports both public and private reviews for when your app is in beta. This API allows to ask for a review and the user can give the review without leaving the app and it is designed to be seamless for users.

The integration consists of four main steps:

1. Define the conditions and best place to ask for a review

2. Request the review flow to the API

3. Launch the review at an appropriate moment

4. Continue the flow after the review is completed

You should not force the user to give the review, whether the user gives the review or not application must run without any interruption. For the best user experience ask for the review when the user become familiar with your application.

How to use this API

This API is available for the Android devices (phones and tablets) running Android 5.0 (API level 21) or higher

// 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 ''

Add above dependency in build.gradle

class InAppReviewViewModel(private val reviewManager: ReviewManager) : ViewModel() {
    private var reviewInfo: Deferred<ReviewInfo>? = null

    fun initReview() {
        if (reviewInfo == null) {
            reviewInfo = viewModelScope.async { reviewManager.requestReview() }

    suspend fun getReviewInfo(): ReviewInfo? = withContext(Dispatchers.Main.immediate) {
        return@withContext reviewInfo?.await().also {
            reviewInfo = null

class ReviewViewModelProviderFactory(
    private val manager: ReviewManager
) : ViewModelProvider.Factory {
    override fun <T : ViewModel> create(modelClass: Class<T>): T {
        return modelClass.getConstructor(

Create InAppReviewViewModel.kt and put that above code in that

package com.example.inappreviewdemo

import android.os.Bundle
import androidx.activity.viewModels
import androidx.lifecycle.lifecycleScope

class MainActivity : AppCompatActivity() {

    private lateinit var reviewManager: ReviewManager

    private val reviewViewModel by viewModels<InAppReviewViewModel> {

    override fun onCreate(savedInstanceState: Bundle?) {
        reviewManager = ReviewManagerFactory.create(this)


    override fun onResume() {
        lifecycleScope.launchWhenResumed {
            reviewViewModel.getReviewInfo()?.let { reviewInfo ->
                reviewManager.launchReview(this@MainActivity, reviewInfo)

Launch reviewManager onResume() or where you want to get the users review and then review flow work smoothly and the user’s review will be posted in the review section on the play store.


Happy Coding!!

There are lots of things are going to come in Android-Development so for the future post notification subscribes to the newsletter. Hope you got something new by this article so please do comment and share this article to others and give them brief about this new API.

Related posts

Top Android Interview Questions on AsyncTask

6 Mins read
You have seen many articles related to android interview Q&A but they all not give you proper android interview Q&A, so in…
5 1 vote
Article Rating
Inline Feedbacks
View all comments
Yachika Joshi
Yachika Joshi
3 months ago

Hi Nitin,
Your article seems to be really helpful, I’ll try to implement this in my own code 🙂