Rate Your Android App using Google In-App Review API

October 28, 2021 Publish By : EXPERT APP DEVS 5 min read Viewed By : 154
google core in app review api

In this article, we are going to learn how to implement in-app review functionality within your Android application using the newly introduced Google core in-app review API.

When a user is interacting with your application, you always want to get feedback from the user about user experience and UI/UX, etc. Feedback will give you hints about what your users think about your application.

Having superior reviews in your application makes a lot of impact on your app like good ranking in the play store and it also impresses a new user to trust and download your app more.

Step 1: in-app review recommendation and determination

One of the main advantages of in-app rating APIs is that you can ask the user for a rating anytime. Like most things, the best time to ask a user for a rating is when they’re most likely to respond the way you want. When we talk about app ratings, we want 5 stars for our app. Anything less is a miss. The best time to ask for a rating is when they have the most tremendous feelings about your app and users have successfully experienced your app’s primary goal. If your app is transactional-based, then you can ask for a review when the user completes a transaction within your app. If your app is content-based, it’s when they’ve viewed the best content they enjoyed and users get something from your app. These “best moments” are times when the emotional connection between your app and user is on the top, the user is very engaged with your app, and at this time the user provides genuine feedback about your app.

Here are some other in-app ratings best practices recommended by Google:

  • Don’t interrupt a user in the middle of a task or any process. Wait until they’ve completed the app’s primary task and reached the last step of the task.
  • Don’t give a rating prompt too early. Users will take some time to make a solid connection with your app before they can provide a meaningful review.
  • Don’t do it too frequently. Since users can choose to skip providing a rating, you will want to prompt them again after some time. But don’t ask again too early or too often, it will frustrate the users and can be given a poor rating. To protect the users from asking users frequently for review Google added limitations in the in-app API.
  • Beautiful UX design will reward you with positive ratings.

We have seen mistakes in apps developed by other IT companies that violate all these best practices recommended by Google. They ask for a rating at the very beginning of the app launch when you use the app and exactly in the middle of trying to complete a primary task. All this accomplishes is getting even more bad reviews.

Step 2: Add the Play Core library

To integrate in-app reviews in your app must add the Play Core library (1.8.0 or higher) in your gradle file. Add play core library into the dependencies section of your project module, build.gradle file. Make sure you declare the maven repository in the project build.gradle repositories part.

// In your project's build.gradle file:
repositories {
  maven { url "https://maven.google.com" }
}

// In your app's build.gradle file:
dependencies {
  // Version 1.8.0 or higher
  implementation 'com.google.android.play:core:1.9.1'

  // For Kotlin users: need to add play core extension.
  implementation 'com.google.android.play:core-ktx:1.8.1'
}

Step 3: Prepare the review request

The next step is creating a ReviewManager instance, which is used for the app’s interface to start an in-app review flow. This is done using the ReviewManagerFactory, which creates ReviewManager instances. It requires the Context as a parameter. When the app is ready to create a request for review, use the ReviewManager instance to create or request a task. If successfully process done, it will retrieve a  ReviewInfo necessary to display to the user:

val reviewManager: ReviewManager = ReviewManagerFactory.create(context)

val requestReviewTask: Task = reviewManager.requestReviewFlow()
requestReviewTask.addOnCompleteListener { request ->
  if (request.isSuccessful) {
    // Request was succeeded and a ReviewInfo instance was received a data
    val reviewInfo: ReviewInfo = request.result
  } else {
    // Request failed
  }
}

Step 4: Request the review

Now, it’s simply a matter of using the ReviewManager to launch the entire review flow. Pass the parameters for the current Activity or fragment and the ReviewInfo created in the previous step. This will return a Task to use as an asynchronous listener that receives a result when the entire review flow is complete:

val launchReviewTask: Task<*> = reviewManager.launchReviewFlow(activity, reviewInfo)
launchReviewTask.addOnCompleteListener { _ ->
  // The review process is done, continue with your app process.
}

When the listener is notified, that means your in-app review flow is complete. That doesn’t mean that the user submits a rating or review for your app. The user may have dismissed the in-app rating dialog, or maybe In-App Review API can reject the request if one was requested within a few times.

Testing In-App Review FlowTesting In-App Review Flow

To test the in-app review integration, you should require a released and approved app in the play store. That doesn’t mean the app should be available to the public; it can be in alpha or beta mode also. At least you should have the account ready for Internal Testing or Closed testing.

  • You can use the Internal Test Track in the play store to release the app and test the in-app review integration.
  • You can use Internal App Sharing or closed. Open testing track to test the in-app review flow.
     

Need a consultation?

Drop us a line! We are here to answer your questions 24/7.