val GOOGLE_PLAY = "com.android.vending"
val intent =
Intent(Intent.ACTION_VIEW)
intent.data = Uri.parse("market://details?id=" + UIUtils.getContext().packageName)
intent.setPackage(GOOGLE_PLAY) //这里对应的是谷歌商店,跳转别的商店改成对应的即可
if (intent.resolveActivity(UIUtils.getContext().packageManager) != null) {
intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK
UIUtils.getContext().startActivity(intent)
} else { //没有应用市场,通过浏览器跳转到Google Play
val intent2 =
Intent(Intent.ACTION_VIEW)
intent2.data = Uri.parse(
"https://play.google.com/store/apps/details?id=" + UIUtils.getContext()
.packageName
)
if (intent2.resolveActivity(UIUtils.getContext().packageManager) != null) {
intent2.flags = Intent.FLAG_ACTIVITY_NEW_TASK
UIUtils.getContext().startActivity(intent2)
}
}
APP跳转google paly更新APP
最新推荐文章于 2023-11-26 18:09:03 发布