【发布时间】:2021-03-04 03:06:18
【问题描述】:
我正在学习Google Play In-App Review。
我在 Android Emulator 中运行 Code A,我希望像 Image A 一样显示 Google 应用内评论 UI,但我只得到信息“aa”,表示请求失败。
我可以在 Android 模拟器中测试 Google Play 应用内评论吗?
代码 A
val manager = ReviewManagerFactory.create(mContext)
val request = manager.requestReviewFlow()
//val manager = FakeReviewManager(mContext)
request.addOnCompleteListener { request ->
if (request.isSuccessful) {
// We got the ReviewInfo object
val reviewInfo = request.result
val flow = manager.launchReviewFlow(mActivity, 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.
Log.e("my","cc")
}
Log.e("my","bb")
} else {
Log.e("my","aa")
// There was some problem, continue regardless of the result.
}
}
【问题讨论】:
-
在“else”代码中添加以下行:@ReviewErrorCode val reviewErrorCode = (task.getException() as TaskException).errorCode .. 并记录 reviewErrorCode 或记录 task.getException跨度>
标签: android google-play-services