Rate Google Play application directly in app [duplicate]
Asked Answered
M

10

55

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.

Metacarpus answered 30/6, 2012 at 0:46 Comment(3)
the code below won't work on emulator because there is no market app there!!Dogmatic
oh, sure I understand. thanks for answer and example of code :)Metacarpus
Link is broken :SInsipid
D
144

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();
    }
}
Dogmatic answered 30/6, 2012 at 1:2 Comment(7)
The code here was taken directly from a previous answer #6900442Slovakia
This post is old but anyway... You can just keep a sharedprefRoselynroseman
They are just redirected to our app on google play store, but how can we find out that user has rated or not ?Schiffman
There is no way to check user has written review for your app or not.Cachalot
there's still no in-app rating feature for android, is there? iOS is doing pretty well with native app ratingsCoralyn
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!Feaze
I found this link which works like iOS, Bottomline being now its possible play.google.com/store/apps/…Saccharate
A
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)));
    }
Alaniz answered 15/11, 2014 at 22:56 Comment(4)
I do not believe there is a way to detect if your has rated your app.Alaniz
ok thanks @Kruherson, thats what i thought, just wanted to confirm.Inaudible
If could be possible check if an user rated an app or not, soon we can see rogue developers punishing users by don't rate. Not a nice idea.Giselagiselbert
this has a better handling of not found.. perfect! thanks.Suppressive
D
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

Daegal answered 19/3, 2015 at 8:48 Comment(1)
They are just redirected to our app on google play store, but how can we find out that user has rated or not ?Schiffman
C
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();
    }
}
Corker answered 10/2, 2013 at 2:51 Comment(2)
They are just redirected to our app on google play store, but how can we find out that user has rated or not ?Schiffman
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.Jimenez
M
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)));
Motorboating answered 30/6, 2012 at 1:2 Comment(0)
A
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);
                        }
                }
            });
Arronarrondissement answered 26/8, 2016 at 6:14 Comment(0)
S
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.

Saccharate answered 6/12, 2019 at 7:5 Comment(2)
did you find the code yet?Taenia
@WuYuanChun I exhausted all the possible options, even asking developer on Linkedin. No response from him checked many apps as well no one provides this feature similar to this sample app.Saccharate
A
0
 Intent intent = new Intent(Intent.ACTION_VIEW);
  intent.setData(Uri.parse("market://details?id=com.test(This is the package name)"));
  startActivity(intent);
Alberto answered 19/3, 2014 at 5:29 Comment(1)
You can use shared preferences file for this. All users are asked once time. And you save their preferences.Maxma
B
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();
    }
}
Boykins answered 5/9, 2018 at 7:30 Comment(0)
A
-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);
Asterisk answered 26/5, 2016 at 9:46 Comment(1)
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 IntentPessa

© 2022 - 2024 — McMap. All rights reserved.