Adroid In App Review

1. Install Google Core Gradle

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

2. Create these method and call it where you want to show.

public void showRateApp() {
ReviewManager reviewManager;
reviewManager = ReviewManagerFactory.create(this);
Task<ReviewInfo> request = reviewManager.requestReviewFlow();
request.addOnCompleteListener(task -> {
if (task.isSuccessful()) {
ReviewInfo reviewInfo = task.getResult();
Task<Void> flow = reviewManager.launchReviewFlow(this, reviewInfo);
flow.addOnCompleteListener(task1 -> {
});
} else {
showRateAppFallbackDialog();
}
});
}

private void showRateAppFallbackDialog() {
new MaterialAlertDialogBuilder(this)
.setTitle(R.string.rate_app_title)
.setMessage(R.string.rate_app_message)
.setPositiveButton(R.string.rate_btn_pos, (dialog, which) -> {

})
.setNegativeButton(R.string.rate_btn_neg,
(dialog, which) -> {
})
.setNeutralButton(R.string.rate_btn_nut,
(dialog, which) -> {
})
.setOnDismissListener(dialog -> {
})
.show();
}

3. Add these strings in string.xml

<string name="rate_app_title">Rate App</string>
<string name="rate_app_message">If you are enjoying our app, please take a moment to rate it on PlayStore. Thanks for your support!</string>
<string name="rate_btn_pos">Rate Now</string>
<string name="rate_btn_neg">Remind me later</string>
<string name="rate_btn_nut">No, Thanks</string>

Leave a Reply

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