Play Core In-App Review API not showing the Review Activity

后端 未结 15 1094
生来不讨喜
生来不讨喜 2021-01-30 05:15

I\'m trying to utilize the Review API (Play Core library 1.8.0) from Google which was just released yesterday. See https://developer.android.com/guide/playcore/in-app-review

15条回答
  •  [愿得一人]
    2021-01-30 05:48

    I just want to share the code that is working reliably today (2020-09-03). It was essentially copied from the official document

    ReviewManager manager = ReviewManagerFactory.create(activity);
    Task request = manager.requestReviewFlow();
    request.addOnCompleteListener(task -> {
        try {
            if (task.isSuccessful()) {
                // We can get the ReviewInfo object
                ReviewInfo reviewInfo = task.getResult();
                Task flow = manager.launchReviewFlow(activity, reviewInfo);
                flow.addOnCompleteListener(task2 -> {
                    // 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.
                    utility.logMessageAsync(activity, "In-app review returned.");
                });
            } else {
                // There was some problem, continue regardless of the result.
                goToAppPage(activity);
            }
        } catch (Exception ex) {
            utility.logExceptionAsync(activity, "Exception from openReview():", ex);
        }
    });
    

    It was tested with internal app sharing on a Android 10. It never failed to show the review dialog.

提交回复
热议问题