public static void rateNow(final Context context) {
try {
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse("market://details?id=" + getPackageName()));
intent.setPackage(GoogleMarket.GOOGLE_PLAY);//这里对应的是谷歌商店,跳转别的商店改成对应的即可
if (intent.resolveActivity(context.getPackageManager()) != null) {
context.startActivity(intent);
} else {//没有应用市场,通过浏览器跳转到Google Play
Intent intent2 = new Intent(Intent.ACTION_VIEW);
intent2.setData(Uri.parse("https://play.google.com/store/apps/details?id=" + getPackageName()));
if (intent2.resolveActivity(context.getPackageManager()) != null) {
context.startActivity(intent2);
} else {
//没有Google Play 也没有浏览器
}
}
} catch (ActivityNotFoundException activityNotFoundException1) {
Log.e(AppRater.class.getSimpleName(), "GoogleMarket Intent not found");
}
}
Android 实现跳转到Google Play 详情页
最新推荐文章于 2024-10-24 16:02:28 发布
本文介绍了一种从Android应用内部跳转至GooglePlay商店页面的方法,通过Intent实现对应用评价页面的直接访问,提供了代码示例并区分了谷歌商店与浏览器跳转的场景。
2万+

被折叠的 条评论
为什么被折叠?



