In-App Review Android Implementation

Posted on

Google Play In-App ReviewAs soon as the review for the app comes into mind, you worry about going to the Playstore, correct? A review is an integral part that lets the developer know how much the users are enjoying their application. But users generally don’t review much of the apps because they don’t want to go to the play store every time just for the review. But you, as a developer want users to give ratings and feedback for your application. So in order to solve this pain of users giving feedback from Playstore, Google developed an In-App Review API for letting users give their feedback directly within the app. Cool, isn’t it? So lets quickly jump into the coding of this. It’s very easy to implement but the testing is quite a pain if you are a new developer. Step 1: Add the Play core dependency in your build.gradle file. implementation ‘com.google.android.play:core:1.8.0’Step 2: Now in your Activitypublic group MainActivity extends AppCompatActivity

private ReviewManager reviewManager; private ReviewInfo reviewInfo;

@Overrideprotected void onCreate(Bundle savedInstanceState) super.onCreate(savedInstanceState); setContentView(R.layout.activity_main);

reviewManager = ReviewManagerFactory.create(this); Taskdanlt; ReviewInfodangt; request = reviewManager.requestReviewFlow(); request.addOnCompleteListener(task -> if (task.isSuccessful()) // We can get the ReviewInfo objectreviewInfo = task.getResult(); else // There was some persoalan, continue regardless of the result. );// Just to test on some button click show the app review obrolan. btnClick.setOnClickListener(new View.OnClickListener() @Overridepublic void onClick(View v) Task // The flow has finished. The API does not indicate whether the user// reviewed or not, or even whether the review obrolan was shown. Thus, no// matter the result, we continue our app flow. ); ); Note: The 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. Note: It is not suggested to show the app review obrolan on a button click. Please read the guidelines here. That’s it. The coding part is completed. Now, the testing part of it. a) Test using an internal test trackUpload your app to the internal test track and install it on a device with a user account that has access to the internal test track. When using an internal test track, the following conditions must be met:The user account is part of the Internal Test Track. The user account is the primary account and it’s selected in the Play Store. The user account has downloaded the app from the Play Store (the app is listed in the user’s Google Play library). The user account does not currently have a review for the app. After the account on the device has downloaded the app at least once from the internal test track and is part of the testers list, you can deploy new versions of the app locally to that device (for example, using Android Studio). b) Test using an internal sharing appAlternatively, for rapid iteration, you can use internal app sharing to test your integration. This method lets you quickly test changes by skipping some of the verification that happens with other test tracks. If you have successfully implemented and uploaded your app to the internal test track, then this is how it would like in real-time.

Google Play In-App ReviewKEY POINTS TO REMEMBER:If you are using the Internal Sharing app to test this, you won’t be able to submit the review. The submit button is disabled in this case. After you have successfully tested it, remove your email from the Internal App Testers list to get the actual Public Review Dialog. Otherwise, you would always get a Private Review. The app review dialog won’t show to users who have already given the ratings on the play store. To test at your end, delete the review from the play store and it will show up. Sometimes, dialog won’t even show up, because of the quota limit of launchReviewFlow. See here for more informasi. You should not depend on the dialog to show up and then you do your remaining work because you don’t get any callback whether the user has given the feedback or not. Done! Happy Coding 😁Reference:If you have any questions, you can reach out to me on email: sa159871@gmail.comOr Follow/Ping me on LinkedIn:

Leave a Reply

Your email address will not be published. Required fields are marked *