Android 直接在应用程序中评价 Google Play 应用程序
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/11270591/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Rate Google Play application directly in app
提问by Matrosov Alexander
回答by K_Anas
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.
评级是通过市场应用程序完成的,因此评级是可信的。如果允许应用自行处理评级,那么开发者可以随时操纵应用的评级。因此,您无法自己处理评级。您只能提示用户访问您在 Google Play 上的应用页面,并要求他们为您的应用评分以获得更多支持。
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();
}
}
回答by TomazStoiljkovic
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)));
}
回答by Kilogen9
You can use 3rd party tool. Here are some commonly used solutions:
您可以使用第 3 方工具。以下是一些常用的解决方案:
appirater: https://github.com/drewjw81/appirater-android/
应用程序:https: //github.com/drewjw81/appirater-android/
apptentive: http://www.apptentive.com/
apptentive:http: //www.apptentive.com/
polljoy: https://polljoy.com
polljoy:https://polljoy.com
AppRater: https://github.com/delight-im/AppRater
AppRater:https: //github.com/delight-im/AppRater
回答by TheMan
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();
}
}
回答by WindsurferOak
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:
用户无法直接在您的应用内为您的应用评分。他们必须去 Google Play 进行评分。如链接所示,您必须重定向用户才能在 Google Play 上查看您的应用:
mContext.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + APP_PNAME)));
回答by Daniel Nyamasyo
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.
对于下面的代码,我使用了 try 和 catch 方法。try 和 catch 方法将按如下方式工作。单击按钮时,try 方法将尝试在您的 android 手机上搜索 Google Play 商店应用程序,如果已经安装并导航到您在 Play 商店中的应用程序,则启动它。但是,如果您的 Android 手机上没有 Play 商店应用程序,则会执行 catch 方法并启动安装在您的应用程序上的浏览器并导航到您在 Play 商店中的应用程序。getPackageName() 是一个内置函数,用于获取您的项目包名称。您可以手动将其添加为字符串。
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);
}
}
});
回答by Swapnil
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 appwhich does that searching for code though.
我正在寻找一个类似于 iOS 的功能,用户不需要被重定向到 Play 商店并再次要求写他的评论。最初,我认为这是不可能的,但幸运的是我的理解已经过时了。找到了这个应用程序,它可以搜索代码。
回答by Swapnil
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();
}
}
回答by pavel
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);
回答by Amol Dale
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse("market://details?id=com.test(This is the package name)"));
startActivity(intent);