We followed this guide (https://developer.android.com/guide/playcore/in-app-review/unity) to implement In-App Review for Unity Android.
We added google-play-core unity plugin and it should be imported correctly in Unity.
The code is:
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.
}
And we invoke the coroutine when we want to show it:
StartCoroutine(requireRate());
Any advice? Thanks