Integrating In-App Review API into Android App

Minimum requirements

  • Android devices should be running on Android 5.0 (API level 21) or higher and should have Google play store installed.
  • Chrome OS devices that have Google play store app installed.
  • Play core library with v1.8.0 or higher.

Design guidelines & Quota restrictions

  • The Review card (popup) should not be tampered or altered by modifying the design.
  • Any overlay should not be added on top or around the card.
  • Review dialog should not be programmatically removed (It will automatically be removed based on user actions)
  • To protect user privacy and avoid API misuse, this API has a limited quota per user. Hence this functionality should not be triggered on a button click.
  • Before presenting the Review card, the app should not ask user opinions like “Do you like the app?” or “Give this app 5 stars”, etc.

Let’s Implement!

  1. Add play-core library as a dependency in your build.gradle file.
implementation 'com.google.android.play:core:1.8.0'
private var reviewInfo: ReviewInfo? = nullval manager = ReviewManagerFactory.create(context)val request = manager.requestReviewFlow()
requestFlow.addOnCompleteListener { request ->
if (request.isSuccessful) {
//Received ReviewInfo object
reviewInfo = request.result
} else {
//Problem in receiving object
reviewInfo = null
}
reviewInfo?.let {
val flow = reviewManager.launchReviewFlow(this@MainActivity, it)
flow.addOnCompleteListener {
//Irrespective of the result, the app flow should continue
}
}

Testing

  1. We often test the new functionalities by creating a new project that would have new ApplicationId. In this case, while you test the app, make sure you give an ApplicationId that is already released and available in the play store.
  2. If you have given feedback in the past for your app, in-app review API’s launchReviewFlow will not present any Review card. It simply triggers a success event.
  3. Due to quota limitations, calling a launchReviewFlow method might not always display a dialog. It should not be linked with any button click event.
  4. To test one of my apps, I had to create a signed apk to see the Review card but for the other app, debug build worked just fine.
  5. To check other design guidelines and when to display a review card, refer to the official document here.

Happy coding folks!!

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Naveen T P

Naveen T P

392 Followers

#AndroidDev | #iOSDev | Kotlin💙 | Swift💛 | Open source enthusiast | https://naveentp.github.io/