Reputation: 780
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
Upvotes: 8
Views: 8651
Reputation: 332
Using the internal test track worked for me, with one major caveat.
I'm not really sure why this is the case, but it appears to be an issue for many years now. So many threads reporting this bug (where GSuite users can't leave Google Play reviews at all), and as of October 2020, Google still hasn't done anything about it. Google lists four conditions in their official documentation to ensure testing works, they should also include this.
Upvotes: 4
Reputation: 378
Simple request review.
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
}
};
}
You only show dialog Review on Published or Internal Test. Make sure that google accounts that are logged in on your device are added to the tester lists.
Read more : https://developer.android.com/guide/playcore/in-app-review/test
Upvotes: 5
Reputation: 44
//Require..
using Google.Play.Review;
public void requestFunction()
{
StartCoroutine(requireRate());
}
//somewhere in your code after completing the game ..
requestFunction();
Package Manager installed: //Google Play In-app Review
testing on other devices, to my surprise on my account it didn’t work, the cause is not known, but I tested on 3 other devices from the list of the internal Google play console test program and very positive response.
Exactly as Vins says
Upvotes: 3
Reputation: 44
I just tested it, and it's functional ..
Testing with game in internal test mode at least it appeared every time it was requested. In my test I didn't use any buttons, I just called the function at a certain stage of my game and it works perfectly.
Upvotes: -1