54

I need to make rate option in my android app.

I found this link

but I'm not sure that want I search. I want to just provide ability for users to rate my app on Google Play.

Matrosov Oleksandr
  • 25,505
  • 44
  • 151
  • 277

10 Answers10

143

The rating is done through market app so that ratings can be trusted. If apps were allowed to handle the rating themselves, then the developer could manipulate the app's rating any time. So there is no way you can handle the rating yourself. You can only prompt the user to your app page on Google Play and ask them to rate your app for more support.

Use the built-in intent to launch market

private void launchMarket() {
    Uri uri = Uri.parse("market://details?id=" + getPackageName());
    Intent myAppLinkToMarket = new Intent(Intent.ACTION_VIEW, uri);
    try {
        startActivity(myAppLinkToMarket);
    } catch (ActivityNotFoundException e) {
        Toast.makeText(this, " unable to find market app", Toast.LENGTH_LONG).show();
    }
}
hvaughan3
  • 10,955
  • 5
  • 56
  • 76
K_Anas
  • 31,226
  • 9
  • 68
  • 81
  • 6
    The code here was taken directly from a previous answer http://stackoverflow.com/questions/6899942/use-application-to-rate-it-on-market?rq=1 – Sofi Software LLC Oct 01 '13 at 18:20
  • This post is old but anyway... You can just keep a sharedpref – An-droid Mar 24 '16 at 10:08
  • They are just redirected to our app on google play store, but how can we find out that user has rated or not ? – Name is Nilay Apr 26 '16 at 09:03
  • There is no way to check user has written review for your app or not. – Muhammad Shauket Aug 30 '16 at 09:44
  • 7
    there's still no in-app rating feature for android, is there? iOS is doing pretty well with native app ratings – Canberk Ozcelik Sep 05 '17 at 13:59
  • 2
    Crazy that Android still doesn't have this. We have an Android & iOS App. Both apps have similar numbers of users. Android version has been around 2+ years longer than the iOS app, and the iOS App has 2x the ratings because you can rate directly inside the app. Get your sh*t together, Google! – DiscDev Jan 08 '19 at 00:39
  • I found this link which works like iOS, Bottomline being now its possible https://play.google.com/store/apps/details?id=com.test.app.inappreview&showAllReviews=true – Swapnil Kadam Dec 06 '19 at 07:08
9

Simple do this...

final String appPackageName = "your.package.name";

try {
      startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + appPackageName)));
    } catch (android.content.ActivityNotFoundException anfe) {
      startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://play.google.com/store/apps/details?id=" + appPackageName)));
    }
TomazStoiljkovic
  • 808
  • 8
  • 21
8

You can use 3rd party tool. Here are some commonly used solutions:

appirater: https://github.com/drewjw81/appirater-android/

apptentive: http://www.apptentive.com/

polljoy: https://polljoy.com

AppRater: https://github.com/delight-im/AppRater

Kilogen9
  • 173
  • 1
  • 7
7
public void launchMarket() 
{
    Uri uri = Uri.parse("market://details?id=" + this.getPackageName());
    Intent myAppLinkToMarket = new Intent(Intent.ACTION_VIEW, uri);
    try 
    {
        mContext.startActivity(myAppLinkToMarket);
    } 
    catch (ActivityNotFoundException e) 
    {
        Toast.makeText(this, " Sorry, Not able to open!", Toast.LENGTH_SHORT).show();
    }
}
TheMan
  • 703
  • 8
  • 11
  • 1
    They are just redirected to our app on google play store, but how can we find out that user has rated or not ? – Name is Nilay Apr 26 '16 at 09:03
  • There is no sure way till now to know whether the user has already rated the app or not. Mostly what I do is just assume that if the user once accepts the rate app dialogue, he/she will rate it. This is to make sure that I don't bug them again and again. – Atin Agrawal Aug 22 '18 at 05:35
3

Users can't rate your app directly from within your app. They must go to Google Play and rate it. Like the link shows, you must redirect the user to view your app on Google Play:

mContext.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + APP_PNAME)));
WindsurferOak
  • 4,861
  • 1
  • 31
  • 36
3

For the code below, I have used try and catch method. The try and catch method will work as follows. On button click, the try method will try to search for the Google play store app on your android phone and launches it if is already installed and navigates to your application on the play store. However, in case you don't have the play store app on your android phone, catch method is executed and launches browser installed on your application and navigates to your application on the play store. getPackageName() is an inbuilt function that gets your project package name. You can add it manually as a string.

String package="com.example.android";

The full code.

   button.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                     try {
                            Uri uri = Uri.parse("market://details?id="+getPackageName()+"");
                            Intent goMarket = new Intent(Intent.ACTION_VIEW, uri);
                            startActivity(goMarket);
                        }catch (ActivityNotFoundException e){
                            Uri uri = Uri.parse("https://play.google.com/store/apps/details?id="+getPackageName()+"");
                            Intent goMarket = new Intent(Intent.ACTION_VIEW, uri);
                            startActivity(goMarket);
                        }
                }
            });
blackgreen
  • 34,072
  • 23
  • 111
  • 129
Daniel Nyamasyo
  • 2,152
  • 1
  • 24
  • 23
1

I was searching for a feature similar to iOS, where the user doesn't need to be redirected to play store and again asked to write his reviews. Initially, I thought this was impossible but thankfully my understanding was outdated. Found this app which does that searching for code though.

Swapnil Kadam
  • 4,075
  • 5
  • 29
  • 35
0
 Intent intent = new Intent(Intent.ACTION_VIEW);
  intent.setData(Uri.parse("market://details?id=com.test(This is the package name)"));
  startActivity(intent);
Amol Dale
  • 231
  • 2
  • 11
  • 1
    You can use shared preferences file for this. All users are asked once time. And you save their preferences. – hkaraoglu Feb 04 '16 at 17:06
0

I always use a method like this one

private void launchMarket() {
    Uri uri = Uri.parse("market://details?id=" + getPackageName());
    Intent goToMarket = new Intent(Intent.ACTION_VIEW, uri);
    try {
        startActivity(goToMarket);
    } catch (ActivityNotFoundException e) {
        Toast.makeText(this, "couldn't launch the market", Toast.LENGTH_LONG).show();
    }
}
-1

Paste this simple code to go play store rating page from your Application

Intent intent1 = new Intent(Intent.ACTION_VIEW,
                        Uri.parse("market://details?id="
                                + MainActivity.this.getPackageName()));
startActivity(intent1);
pavel
  • 1,603
  • 22
  • 19
  • This will not work if there are no market app installed on your device. You need to try/catch to handle following exception: android.content.ActivityNotFoundException: No Activity found to handle Intent – Rajeev Jayaswal Aug 22 '20 at 17:34