Google Play In-App Review API: A Step-by-Step Implementation Guide

In the summer of 2020, a cool new functionality appeared in the Play Core library - In-App Review [1] . Using this feature, you can implement a dialogue with user feedback and rating. It is very convenient and does not break the user's script. This feature is useful for ranking and promotion. For example, after implementation in one of the applications, the number of assessments increased 5 times [2] . In this article, I'll show you how to embed In-App Review into your app.



Manual



Add dependencies



Add the build.gradlefollowing dependencies to yours :



dependencies {

    implementation 'com.google.android.play:core:1.8.0'

    implementation 'com.google.android.play:core-ktx:1.8.1'

}


Implementation



Add the following code to invoke the app evaluation dialog:



private fun requestReviewFlow(activity: Activity) {

    val reviewManager = ReviewManagerFactory.create(activity)

    val requestReviewFlow = reviewManager.requestReviewFlow()

    requestReviewFlow.addOnCompleteListener { request ->

        if (request.isSuccessful) {

            val reviewInfo = request.result

            val flow = reviewManager.launchReviewFlow(activity, reviewInfo)

            flow.addOnCompleteListener {

                //    

            }

        } else {

            //   

        }
    }
} 


Also, if necessary, add a flag to SharedPreference, which can be checked if you want to call the script only once. It should be borne in mind that the dialog as a whole can be called only a limited number of times [3] , and it is also impossible to check using the API whether the user has been reviewed or not [4] . How to add In-App Review to Unity or native code, read the following documentation [5] , [6] .



Testing



You can only test the In-App Review script if the application was downloaded through Google Play, so there are two ways to test the script by hand:



  1. Internal Test Track: , , Google Play Store.
  2. Internal App Sharing: , .apk ( .aab) Google Play.


Unit- API FakeReviewManager. In-App Review Internal App Sharing.



Internal app sharing



, .apk ( .aab) Google Play, Internal App Sharing:





, , , .apk ( .aab):





, , , :





, , https://play.google.com/console/u/0/internal-app-sharing .apk ( .aab):





. , ? Google Play , , โ€œPlay Store versionโ€, , :





:





:





.





Google Play Core has provided an excellent app ranking tool that can be easily implemented and tested. In-App Review testing can only be carried out with .apk files that have been downloaded and installed through the Google Play Store, for example, through the Internal App Sharing mechanism. At the same time, the apk size will increase by 100 KB, the dex file will increase by 200 classes and approximately 500 methods, which, perhaps, will delight the apk optimizers developers.




All Articles