Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Android端末でIn-App Review APIを呼ぶサンプル
using System.Collections;
using Google.Play.Review;
using UnityEngine;
/// <summary>
/// Android端末でIn-App Review APIを呼ぶサンプル
/// </summary>
public class Sandbox_InAppReviewAPI : MonoBehaviour
{
private void Start()
{
StartCoroutine(ShowReviewCoroutine());
}
private IEnumerator ShowReviewCoroutine()
{
// https://developer.android.com/guide/playcore/in-app-review/unity
var reviewManager = new ReviewManager();
var requestFlowOperation = reviewManager.RequestReviewFlow();
yield return requestFlowOperation;
if (requestFlowOperation.Error != ReviewErrorCode.NoError)
{
// エラーの場合はここで止まる.
yield break;
}
var playReviewInfo = requestFlowOperation.GetResult();
var launchFlowOperation = reviewManager.LaunchReviewFlow(playReviewInfo);
yield return launchFlowOperation;
if (launchFlowOperation.Error != ReviewErrorCode.NoError)
{
// エラーの場合はここで止まる.
yield break;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment