Rate Google Play application directly in app

此生再无相见时 提交于 2019-11-26 09:29:48

问题


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.


回答1:


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();
    }
}



回答2:


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)));
    }



回答3:


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();
    }
}



回答4:


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




回答5:


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)));



回答6:


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.

Also see for amazon store

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);
                        }
                }
            });



回答7:


 Intent intent = new Intent(Intent.ACTION_VIEW);
  intent.setData(Uri.parse("market://details?id=com.test(This is the package name)"));
  startActivity(intent);



回答8:


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);



回答9:


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();
    }
}


来源:https://stackoverflow.com/questions/11270591/rate-google-play-application-directly-in-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!