Adreno Adreno - 4 months ago 28
Android Question

"Rate This App"-link in Google Play store app on the phone

I'd like to put a "Rate This App"-link in an Android App to open up the app-listing in the user's Google Play store app on their phone.


  1. What code do I have to write to create the
    market://
    or
    http://
    -link open in the Google Play store app on the phone?

  2. Where do you put the code?

  3. Does anyone have a sample implementation of this?

  4. Do you have to specify the screen where the
    market://
    or
    http://
    link will be placed, and which is the best to use -
    market://
    or
    http://
    ?


Answer

I open the Play Store from my App with the following code:

    Uri uri = Uri.parse("market://details?id=" + context.getPackageName());
    Intent goToMarket = new Intent(Intent.ACTION_VIEW, uri);
    // To count with Play market backstack, After pressing back button, 
    // to taken back to our application, we need to add following flags to intent. 
    goToMarket.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY |
                    Intent.FLAG_ACTIVITY_NEW_DOCUMENT |
                    Intent.FLAG_ACTIVITY_MULTIPLE_TASK);
    try {
        startActivity(goToMarket);
    } catch (ActivityNotFoundException e) {
        startActivity(new Intent(Intent.ACTION_VIEW,
                Uri.parse("http://play.google.com/store/apps/details?id=" + context.getPackageName())));
    }

This will launch the Play Store with your App page already opened. The user can rate it there.

Comments