android - 适用于 Unity 的 Google In-App Review 未显示,未引发错误

标签 android unity3d google-play

我们按照本指南 (https://developer.android.com/guide/playcore/in-app-review/unity) 为 Unity Android 实现应用内审查。
我们添加了 google-play-core unity 插件,它应该在 Unity 中正确导入。
代码是:

private IEnumerator requireRate(){
    // Create instance of ReviewManager
    ReviewManager _reviewManager;
    // ...
    _reviewManager = new ReviewManager();
    var requestFlowOperation = _reviewManager.RequestReviewFlow();
    yield return requestFlowOperation;
    if (requestFlowOperation.Error != ReviewErrorCode.NoError)
    {
        // Log error. For example, using requestFlowOperation.Error.ToString().
        yield break;
    }
    PlayReviewInfo _playReviewInfo = requestFlowOperation.GetResult();
    var launchFlowOperation = _reviewManager.LaunchReviewFlow(_playReviewInfo);
    yield return launchFlowOperation;
    _playReviewInfo = null; // Reset the object
    if (launchFlowOperation.Error != ReviewErrorCode.NoError)
    {
        // Log error. For example, using requestFlowOperation.Error.ToString().
        yield break;
    }
    // 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.
}
当我们想要显示协程时,我们会调用它:
StartCoroutine(requireRate());
有什么建议吗?
谢谢

最佳答案

简单的请求审查。

using Google.Play.Review;
... 
public void RequestReview()
{
    // StartCoroutine(AndroidReview());
    var reviewManager = new ReviewManager();

    // start preloading the review prompt in the background
    var playReviewInfoAsyncOperation = reviewManager.RequestReviewFlow();

    // define a callback after the preloading is done
    playReviewInfoAsyncOperation.Completed += playReviewInfoAsync =>
    {
        if (playReviewInfoAsync.Error == ReviewErrorCode.NoError)
        {
            // display the review prompt
            var playReviewInfo = playReviewInfoAsync.GetResult();
            reviewManager.LaunchReviewFlow(playReviewInfo);
        }
        else
        {
            // handle error when loading review prompt
        }
    };
}
您仅在 上显示对话框审阅发表 内部测试 .确保在您的设备上登录的 google 帐户已添加到测试人员列表中。
阅读更多:https://developer.android.com/guide/playcore/in-app-review/test

关于android - 适用于 Unity 的 Google In-App Review 未显示,未引发错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63599424/

相关文章:

android - Google Play Android Developer API 更改同一次购买的初始购买时间

java - 如何删除 android 中 Bottom Sheet 单对话框 fragment 创建的阴影?

android - DatePicker 小部件(不是对话框)OnDateSet/OnClick 事件?

c# - 使用 IL2CPP 在 Visual Studio 中调试 Unity Hololens?

c# - 绘制至少一个像素宽的对象

c# - 使用内联 Lambda 函数作为参数

android - 用户无法在 Play 商店中评价/评论我的应用程序

java - 如何设置 onItemClick 方法以显示我在 ListView 中单击的文本?

java - 未生成 Oauth 签名

Android 应用提交。删除日志记录的简单方法?