How to ask user for rate the app manually in android

void rateThisApp() {

final SweetAlertDialog pDialog = new SweetAlertDialog(HomeActivity.this, SweetAlertDialog.WARNING_TYPE);
pDialog.getProgressHelper().setBarColor(R.color.colorPrimaryDark);

pDialog.setTitleText("If you like then please 5 star.");
pDialog.setConfirmText("Rate 5 star");
pDialog.setConfirmClickListener(sDialog -> {
sDialog.dismissWithAnimation();
PACKAGE_NAME = getApplicationContext().getPackageName();
try {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + PACKAGE_NAME)));
} catch (android.content.ActivityNotFoundException anfe) {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://play.google.com/store/apps/details?id=" + PACKAGE_NAME)));
}
});
pDialog.setCancelButton("Cancel", sDialog -> sDialog.dismissWithAnimation());
pDialog.show();

}

Leave a Reply

Your email address will not be published. Required fields are marked *