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

后端 未结 15 1238
生来不讨喜
生来不讨喜 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() {
            @Override
            public void onComplete(@NonNull Task 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() {
                        @Override
                        public void onComplete(@NonNull Task 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.

提交回复
热议问题