【问题标题】:Can I test Google Play In-App Review in Android Emulator?我可以在 Android 模拟器中测试 Google Play 应用内评论吗?
【发布时间】: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.
                }
     }

图片 A

【问题讨论】:

  • 在“else”代码中添加以下行:@ReviewErrorCode val reviewErrorCode = (task.getException() as TaskException).errorCode .. 并记录 reviewErrorCode 或记录 task.getException跨度>

标签: android google-play-services


【解决方案1】:

是的,您可以通过模拟器测试应用内评论。但必须需要在您的模拟器上安装游戏商店。并且必须登录。

应用内评论仅适用于以下设备:

  1. 运行 Android 5.0(API 级别 21)或更高版本并安装了 Google Play 商店的 Android 设备(手机和平板电脑)。
  2. 安装了 Google Play 商店的 Chrome 操作系统设备。

并使用 -

进行测试

val manager = FakeReviewManager(context)

您可以在此网址上获得更多详细信息 - Test in-app review

【讨论】:

  • 谢谢!还有更多,代码 A 不会总是显示评级 UI,Google 会决定是否显示,这是真的吗?
  • FakeReviewManager 仅用于单元测试,不显示 UI。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2011-01-06
  • 2022-11-13
  • 1970-01-01
  • 2018-04-19
  • 2014-12-02
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多