我有这样一种情况,我使用此方法调用应用程序内评论的对话框,但当测试版本是应用程序或应用程序在 Play 商店中上线时,该对话框不会出现。但是,LogCat Info 显示在调用代码时正确调用了该方法。任何人都可以提供意见或建议,谢谢。
https://developer.android.com/guide/playcore/in-app-review
Gradle
implementation 'com.google.android.play:core:1.8.0'
创建时
Log.i("rate", "CALL MANAGER");
askRatings();
代码
void askRatings() {
ReviewManager manager = ReviewManagerFactory.create(this);
com.google.android.play.core.tasks.Task<ReviewInfo> request = manager.requestReviewFlow();
request.addOnCompleteListener(task -> {
if (task.isSuccessful()) {
// We can get the ReviewInfo object
ReviewInfo reviewInfo = task.getResult();
Log.i("rate", "SUCCESS FLOW");
com.google.android.play.core.tasks.Task<Void> flow = manager.launchReviewFlow(this, 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.
});
} else {
Log.i("rate", "NOT A SUCCESS FLOW");
}
});
}
日志
2020-08-18 11:17:03.641 13328-13328/my.app I/rate: CALL MANAGER
2020-08-18 11:17:03.764 13328-13328/my.app I/rate: SUCCESS FLOW
最佳答案
我必须使用内部应用共享和 Android 10 模拟器才能看到该对话框。在 Android 9 及之前的版本中,我看到的日志与您看到的相同,但没有弹出评论。无论如何,我确实看到 android 虚拟按钮菜单出现了一秒钟的故障,所以我相信这意味着流程正在运行。
关于java - In-App Review 调用 Log 但不发起对话,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63465621/