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

后端 未结 15 1092
生来不讨喜
生来不讨喜 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:40

    For all the users that needs a working JAVA code, please find my code below:

    ReviewInfo reviewInfo;
    ReviewManager manager;
    

    OnCreate

    manager = ReviewManagerFactory.create(this);
    
    private void Review(){
        manager.requestReviewFlow().addOnCompleteListener(new OnCompleteListener<ReviewInfo>() {
            @Override
            public void onComplete(@NonNull Task<ReviewInfo> task) {
                if(task.isSuccessful()){
                    reviewInfo = task.getResult();
                    manager.launchReviewFlow(MainActivity.this, reviewInfo).addOnFailureListener(new OnFailureListener() {
                        @Override
                        public void onFailure(Exception e) {
                            Toast.makeText(MainActivity.this, "Rating Failed", Toast.LENGTH_SHORT).show();
                        }
                    }).addOnCompleteListener(new OnCompleteListener<Void>() {
                        @Override
                        public void onComplete(@NonNull Task<Void> task) {
                            Toast.makeText(MainActivity.this, "Review Completed, Thank You!", Toast.LENGTH_SHORT).show();
                        }
                    });
                }
    
            }
        }).addOnFailureListener(new OnFailureListener() {
            @Override
            public void onFailure(Exception e) {
                Toast.makeText(MainActivity.this, "In-App Request Failed", Toast.LENGTH_SHORT).show();
            }
        });
    }
    

    Make sure the below is implemented:

    implementation 'com.google.android.play:core:1.8.0'
    

    And please also note, that the dialog will only display if your app is in production, alpha or internal testing on the Google Play Console Account.

    0 讨论(0)
  • 2021-01-30 05:40

    Documentation says that it won't be shown every time you request it since it has quota restrictions: https://developer.android.com/guide/playcore/in-app-review#quotas

    I just included it in my project and it showed the dialog only one time. It is a little inconvenient since we don't have any controls over it.

    Also, I noticed that if you try to show the dialog again and again, navigation bar starts blinking (like it wants to show the dialog but it gets dismissed).

    0 讨论(0)
  • 2021-01-30 05:46

    My working code:

    private fun askForReview() {
        val manager = ReviewManagerFactory.create(this)
        manager.requestReviewFlow().addOnCompleteListener { request ->
            if (request.isSuccessful) {
                val reviewInfo = request.result
                manager.launchReviewFlow(this, reviewInfo).addOnFailureListener {
                    logWarning("In-app review request failed, reason=$it")
                }.addOnCompleteListener { _ ->
                    logInfo("In-app review finished")
                }
            } else {
                logWarning("In-app review request failed, reason=${request.exception}")
            }
        }
    }
    

    Tested on an app from Internal Test track (there is no quota there).

    0 讨论(0)
  • 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<ReviewInfo> request = manager.requestReviewFlow();
    request.addOnCompleteListener(task -> {
        try {
            if (task.isSuccessful()) {
                // We can get the ReviewInfo object
                ReviewInfo reviewInfo = task.getResult();
                Task<Void> 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.

    0 讨论(0)
  • 2021-01-30 05:51

    I also saw the same problem, my request review flow works, then the launch review flow works, but nothing displays (I do notice the small line at the center of the bottom of the screen appears briefly, and my audio cuts out briefly as the app is paused and then resumed but no review flow appeared).

    I was able to get it to work by adding a user to my device that was not in my list of License Testers (Google developer console) and had not reviewed my app previously. I was able to display the rating popup once, I cancelled the operation so that I could test it again, but it would not reappear afterwards. It appears to be a one shot thing and they are aggressively guarding against annoying the user with review popups.

    This feature doesn't seem useful for my case, I have a button on the settings screen to rate my app. Since I have no way of knowing what happened, I can't thank the user, I can't disable the button or display an "you already rated this thank you" message, and the button just appears to do nothing so it looks like a bug. I guess the intended use is to ask the user during gameplay, and if they cancel the dialog accidentally then it's just too bad for you.

    Ideally Google should allow License Testing users to display this popup more than once for testing purposes.

    0 讨论(0)
  • 2021-01-30 05:52

    The documentation says

    To provide a great user experience, Google Play enforces a quota on how often a user can be shown the review dialog. Because of this, calling a launchReviewFlow method might not always display a dialog. For example, you should not have a call-to-action option (such as a button) to trigger a review as a user might have already hit their quota and the flow won’t be shown, presenting a broken experience to the user.

    So you don't expect it to show the dialog every time and also there's no way to know if the dialog is shown or not nor the user has reviewed your app or not either

    0 讨论(0)
提交回复
热议问题