Android In App Review

Jan 28 2021 · Kotlin 1.4, Android 5, Android Studio 4

Part 1: Implementing In App Review

07. Connect The Manager To UI

Episode complete

Play next episode

Next
About this episode
Leave a rating/review
See forum comments
Cinema mode Mark complete Download course materials
Previous episode: 06. Implement The In App Review Manager Next episode: 08. Test Your In App Review Feature

Get immediate access to this and 4,000+ other videos and books.

Take your career further with a Kodeco Personal Plan. With unlimited access to over 40+ books and 4,000+ professional videos in a single subscription, it's simply the best investment you can make in your development career.

Learn more Already a subscriber? Sign in.

Heads up... You’re accessing parts of this content for free, with some sections shown as obfuscated text.

Heads up... You’re accessing parts of this content for free, with some sections shown as obfuscated text.

Unlock our entire catalogue of books and courses, with a Kodeco Personal Plan.

Unlock now

The final step you need to take before testing the In App Review feature is to connect the manager to the rest of your app. Start off by creating an interface in the inappreview module, called InAppReviewView:

interface InAppReviewView {

  fun showReviewFlow()
}
  @Inject
  lateinit var inAppReviewManager: InAppReviewManager

  private fun onLeaveReviewTapped() {
    preferences.setUserRatedApp(true)
    inAppReviewManager.startReview(requireActivity())
    dismissAllowingStateLoss()
  }
  @Inject
  lateinit var reviewManager: InAppReviewManager
  override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
    super.onViewCreated(view, savedInstanceState)
    viewModel.setInAppReviewView(this) // here
    initUi()
    initObservers()
    loadCollection()
    checkAndShowOnboarding()
  }
  override fun showReviewFlow() {
    if (reviewManager.isEligibleForReview()) {
      val dialog = InAppReviewPromptDialog()

      dialog.show(childFragmentManager, null)
    }
  }
  private lateinit var inAppReviewView: InAppReviewView

  fun setInAppReviewView(inAppReviewView: InAppReviewView) {
    this.inAppReviewView = inAppReviewView
  }
  fun checkIfNeedsReviewPrompt() {
    val value = collection.value ?: return

    if (value.isProgressionFinished()) {
      inAppReviewView.showReviewFlow()
    }
  }