评分
try {
Uri uri = Uri.parse("market://details?id=" + getPackageName());
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
} catch (Exception e) {
Toast.makeText(this, "您的系统中没有安装应用市场", Toast.LENGTH_SHORT).show();
e.printStackTrace();
}
更新
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse("market://details?id=" + getPackageName()));
if (intent.resolveActivity(getPackageManager()) != null) {
startActivity(intent);
} else {
Toast.makeText(this, "您的系统中没有安装应用市场", Toast.LENGTH_SHORT).show();
}
转载至链接:https://my.oschina.net/yaly/blog/1932767