In App Review
In App review Implementation using google play core library
The Google Play In-App Review API lets you prompt users to submit Play Store ratings and reviews without the inconvenience of leaving your app or game.
Steps:
1- Import the Play Core Library into your Android project as a Gradle dependency
implementation 'com.google.android.play:core:1.10.0'
2- Create instance of ReviewManager
ReviewManager manager = ReviewManagerFactory.create(this);
3- Request a ReviewInfo object, use the ReviewManager
instance to create a request task. If successful, the API returns the ReviewInfo
object needed to start the in-app review flow.
Task<ReviewInfo> request = manager.requestReviewFlow();
request.addOnCompleteListener(new OnCompleteListener<ReviewInfo>() {
@Override
public void onComplete(@NonNull Task<ReviewInfo> task) {
if (task.isSuccessful()) {
// We can get the ReviewInfo object
reviewInfo = task.getResult();
lunchappreview(reviewInfo);
} else {
// There was some problem, log or handle the error code.
Toast.makeText(MainActivity.this, "Something went wrong", Toast.LENGTH_SHORT).show();
}
}
});
4- Launch the in-app review flow , Use the ReviewInfo
instance to launch the in-app review flow.
private void lunchappreview(ReviewInfo reviewInfo) {
// in app review last step
if(reviewInfo != null){
Task<Void> flow = manager.launchReviewFlow(this, reviewInfo);
flow.addOnCompleteListener(new OnCompleteListener<Void>() {
@Override
public void onComplete(@NonNull Task<Void> task) {
Toast.makeText(MainActivity.this, "Thanks for review the app", Toast.LENGTH_SHORT).show();
}
});
}