如何启动应用内审核流程 - 使用当前活动上下文或创建新活动?

问题描述 投票:0回答:1

使用 Google 的指南,我们获得以下 Kotlin 代码来启动应用内审核流程...

val activity = ??? // what should we use for activity?
val manager = ReviewManagerFactory.create(activity)
val request = manager.requestReviewFlow()

request.addOnCompleteListener { task ->
    if (task.isSuccessful) {
        // We got the ReviewInfo object
        val reviewInfo = task.result
        val flow = manager.launchReviewFlow(activity, reviewInfo)
        flow.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 {
        // There was some problem, log or handle the error code.
        @ReviewErrorCode val reviewErrorCode = (task.getException() as ReviewException).errorCode
    }
}

https://developer.android.com/guide/playcore/in-app-review/kotlin-java

但是,我找不到任何有关是否应创建新活动或是否应使用当前正在运行的活动的指导。

我想在用户在我的应用程序中发布内容后请求审核。但是,尚不清楚我将其放入 ViewModel 和可组合项之间的常用控制流中的哪个位置。

感谢您的帮助!

android kotlin android-jetpack-compose google-play
1个回答
0
投票

通常,我们会提示用户在完成某些任务的活动中进行应用内审核(在您的情况下,发布一些内容)。故意创建一个新的活动来启动应用内评论是没有意义的,因为不能保证显示应用内评论。

© www.soinside.com 2019 - 2024. All rights reserved.