我们按照本指南 (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/