-
-
Save ivangarzab/1ae57a915f86aafac9a8c264d80db317 to your computer and use it in GitHub Desktop.
Single function to fully trigger an In-App Review using the native Play Store library
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private fun startInAppReviewFlow() { | |
// from Fragment class | |
with(ReviewManagerFactory.create(requireContext())) { | |
requestReviewFlow() | |
.addOnCompleteListener { task -> | |
if (task.isSuccessful) { | |
launchReviewFlow(requireActivity(), task.result) | |
.addOnCompleteListener { _ -> | |
// The flow has finished. The API does not indicate whether the user | |
// reviewed or not, or even whether the review dialog was shown. Thus, no | |
// matter the result, we continue our app flow. | |
} | |
} else { | |
Log.w(TAG, "There was a problem requesting the review flow ${task.exception}") | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment