I implemented Play Core Library's in-app review but the review pops up when I open the app for the first time.
Is there a way to open that pop-up box only after the app has been used for 10 days or something?
I have used this code to implement it:
ReviewManager manager;
ReviewInfo reviewInfo;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.abc);
manager = ReviewManagerFactory.create(this);
Task<ReviewInfo> request = manager.requestReviewFlow();
request.addOnCompleteListener(task -> {
if (task.isSuccessful()) {
// We can get the ReviewInfo object
reviewInfo = task.getResult();
openReview();
}
});
}
public void openReview(){
if(reviewInfo != null){
Task<Void> flow = manager.launchReviewFlow(this, reviewInfo);
flow.addOnCompleteListener(task -> {
// 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.
});
}
I would do it like this:
SharedPreferences
SharedPreferences