原本区分应用渠道跳转不同应用市场,但是在小米手机上出现了无响应的情况,最终放弃了跳转指定应用市场的方法,改为仅做跳转不做控制;
String pkgName = context.getPackageName();
Uri uri = Uri.parse("market://details?id=" + pkgName);
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
try {
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
return true;
} catch (Exception e) {
return false;
}
原本的跳转区分:
when (channelId) {
"oppo" -> {
chanelName = "OPPO应用商店"
intent.setClassName("com.oppo.market", "a.a.a.aoz")
}
"vivo" -> {
chanelName = "VIVO应用商店"
intent.setClassName("com.bbk.appstore", "com.bbk.appstore.ui.AppStoreTabActivity")
}
"baidu" -> {
chanelName = "百度手机助手"
intent.setPackage("com.baidu.appsearch")
}
"anzhi" -> {
chanelName = "cn.goapk.market"
intent.setPackage("安智市场")
}
"huawei" -> {
chanelName = "华为应用市场"
intent.setClassName("com.huawei.appmarket", "com.huawei.appmarket.service.externalapi.view.ThirdApiActivity")
}
"xiaomi" -> {
chanelName = "小米应用商店"
intent.setClassName("com.xiaomi.market", "com.xiaomi.market.ui.AppDetailActivity")
}
"meizu" -> {
chanelName = "魅族应用商店"
intent.setClassName("com.meizu.mstore", "com.meizu.flyme.appcenter.activitys.AppMainActivity")
}
"samsung" -> {
chanelName = ""
intent.data = Uri.parse("http://www.samsungapps.com/appquery/appDetail.as?appId=$apkName")
intent.setClassName("com.sec.android.app.samsungapps", "com.sec.android.app.samsungapps.Main")
}
"360" -> {
chanelName = "360手机助手"
intent.setClassName("com.qihoo.appstore", "com.qihoo.appstore.distribute.SearchDistributionActivity")
}
"yingyongbao" -> {
chanelName = "应用宝"
intent.setClassName("com.tencent.android.qqdownloader", "com.tencent.pangu.link.LinkProxyActivity")
}
"wandoujia" -> {
chanelName = "豌豆荚"
intent.setClassName("com.wandoujia.phoenix2", "com.pp.assistant.activity.PPMainActivity")
}
"pp" -> {
chanelName = "PP助手"
intent.setClassName("com.pp.assistant", "com.pp.assistant.activity.MainActivity")
}
"ali" -> {//pp助手,豌豆荚,淘宝手机助手,九游,UC应用商城,神马搜索
//TODO
chanelName = "应用市场"
intent.setPackage("")
}
else -> {
chanelName = "应用宝"
intent.setClassName("com.tencent.android.qqdownloader", "com.tencent.pangu.link.LinkProxyActivity")
}
}
2020-04-26