Home > OS >  How to show in-app review dialog when app installed a certain number of days and in use for a certai
How to show in-app review dialog when app installed a certain number of days and in use for a certai

Time:02-28

I'm using Google guide about in-app review dialog. i'm using standard Google offers:

val manager = ReviewManagerFactory.create(context)

private fun startInnAppReview() {
        val requestFlow = manager.requestReviewFlow()
        requestFlow.addOnCompleteListener { request ->
            if (request.isSuccessful) {
                manager.launchReviewFlow(this, request.result).apply {
                    addOnFailureListener { exception -> Timber.e(exception) }
                }
            } else {
                Timber.e("${request.exception}")
            }
        }
    }

And i need to show this in-app dialog only once when app is installed for 5 days and in use more than 20 minutes. Can you explain an optimal variation of making it? I guess we need to use preferences?

CodePudding user response:

You can schedule tasks using WorkManager, you need to check the docs to decide which task type(s) best suit your use case.

CodePudding user response:

I would use SharedPreferences and two variables, one for installation time and another one to keep track of the time the app is used, then when both satisfy the conditions, show the dialog.

  • Related