0

I have created an alertdialog box that shows up when the user first clicks on my app, what I want to know is how to direct the app to my app in the Play Store and save what was selected so that the box does not show up again. Please help, thanks!

AlertDialog.Builder b=  new  AlertDialog.Builder(this)
                .setTitle("Review and Rate Converjz!")
                .setMessage("Click on OK to review and rate Converjz, your feedback" +
                        "and ratings are greatly apreciated! We need your help to improve our app in order to provide you with a better" +
                                " experience. Thanks!")
                .setPositiveButton("OK", new DialogInterface.OnClickListener() {
                            public void onClick(DialogInterface dialog, int whichButton) {
                            dialog.dismiss();


                            }


                        }
                )
                .setNegativeButton("CANCEL",
                        new DialogInterface.OnClickListener() {
                            public void onClick(DialogInterface dialog, int whichButton) {
                                dialog.dismiss();
                               dialog.cancel();
                            }
                        }
                );
        b.show();
nosh
  • 620
  • 3
  • 14
  • 50

2 Answers2

1

Here's how to link to your app in play store:

Uri uri = Uri.parse("market://details?id=" + getPackageName());
Intent openPlayStore = new Intent(Intent.ACTION_VIEW, uri);
try {
   startActivity(openPlayStore);
} catch (ActivityNotFoundException e) {
    Toast.makeText(mActivity, " unable to find market app",   Toast.LENGTH_LONG).show();
}

You cannot save what the user rated or if he rated, but you can save in SharedPreferences that you asked for a rating

DANGERZONE94
  • 139
  • 1
  • 9
0

You can use make you own link that opens the Play Store link and save that user action information in Shared Preference.But its common requirement amongst developer hence use folowing libraries-

https://github.com/fernandodev/easy-rating-dialog

https://github.com/hotchemi/Android-Rate

Hope that solves the problem.

Gufran Khurshid
  • 888
  • 2
  • 9
  • 28
  • You can use library https://github.com/Vorlonsoft/AndroidRate (`implementation 'com.vorlonsoft:androidrate:1.0.3'`) . It's up to date. – Alexander Savin Nov 08 '17 at 05:32