iTranslated by AI

The content below is an AI-generated translation. This is an experimental feature, and may contain errors. View original article
🗂

Using In-App Reviews to Get App Ratings Without Navigating to the Store

に公開

I have updated and corrected the article originally posted on Note.

Official Documentation

Fragment

view.findViewById<Button>(R.id.btnReview)
    .clicks()
    .onEach {
//      val manager = ReviewManagerFactory.create(requireContext())
        val manager = FakeReviewManager(requireContext())
        val request = manager.requestReviewFlow()
        request.addOnCompleteListener { request ->
            if (request.isSuccessful) {
                val reviewInfo = request.result
                val flow = manager.launchReviewFlow(requireActivity(), reviewInfo)
                flow.addOnCompleteListener { _ ->
                    Toast.makeText(requireContext(), "Finished", Toast.LENGTH_SHORT).show()
                }
            } else {
                // An error occurred, but you shouldn't worry about it
            }
        }

    }
    .launchIn(viewLifecycleOwner.lifecycleScope)

Use FakeReviewManager during implementation, and then use ReviewManagerFactory.create afterward.

To actually verify the behavior, you can use Internal App Sharing on the Play Console. While you won't be able to submit an actual review, you can see the flow in action, making it easy to test.

At this point, it is not possible to know if the target user has already reviewed the app, nor can you tell if they actually submitted a review or canceled it after being prompted.

Guidelines

When using in-app reviews, you must follow the guidelines.

Guideline Translation as of 8/8 (No guarantee)

  • Prompt for a review only after the user has experienced enough of the app or game.
  • Do not excessively request reviews from the user.
  • Do not ask the user questions about the app or request a 5-star rating before asking for a review.

Design Guideline Translation as of 8/8 (No guarantee)

  • Use the rating screen as is, without modifying its design, including size or transparency.
  • Do not add any overlays on top of or around the rating screen.
  • The rating screen and its background must be on the top layer; do not programmatically remove the screen once it is displayed.
    It will be removed automatically by the user's action or the library's behavior.

Sample Code

https://github.com/sobaya-0141/AllFlow/tree/in_app_review

Discussion