普通跳转
Tip:该跳转可适配普通的跳转,比如跳转豌豆荚
//appPkg是你要跳转的包名
//marketPkg是你使用的应用商店,如果传空,则会把你手机上的应用商店全部列出来
try {
if (TextUtils.isEmpty(appPkg)) return;
Uri uri = Uri.parse("market://details?id=" + appPkg);
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
if (!TextUtils.isEmpty(marketPkg)) {
intent.setPackage(marketPkg);
}
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
} catch (Exception e) {
e.printStackTrace();
}
跳转三星应用商店:
因为开发时用的是三星的手机,所以普通的手机一直跳转不了,就上网查,网上有个大神的一篇博客:https://blog.csdn.net/scau_zhangpeng/article/details/79098613
解释到,三星的应用商店的跳转,使用的uri是不一样的,但是他的这篇文章中给出的代码,我用起来还是不行,于是就顺着该博客给出的思路,考虑是不是三星商店的uri换了或者是更新了,于是,废了一些