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();
}
}
只需简单地执行以下操作...
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)));
}
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();
}
}
String package="com.example.android";
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);
}
}
});
用户无法直接在您的应用中对其进行评级。他们必须前往Google Play并对其进行评级。如链接所示,您必须将用户重定向到Google Play上查看您的应用程序:
mContext.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + APP_PNAME)));
我经常使用这样的方法
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();
}
}
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse("market://details?id=com.test(This is the package name)"));
startActivity(intent);
将这段简单的代码粘贴到您的应用程序中,即可转到Google Play商店评分页面
Intent intent1 = new Intent(Intent.ACTION_VIEW,
Uri.parse("market://details?id="
+ MainActivity.this.getPackageName()));
startActivity(intent1);