如何在我的应用程序中打开Goog​​le Play商店应用程序页面?

时间:2019-11-13 15:46:27

标签: java android

在我的应用中,我想要一个按钮,该按钮会将用户带到另一个应用的Google Play商店应用页面。

我希望它在Play商店而不是浏览器中打开。

1 个答案:

答案 0 :(得分:0)

final String appPackageName = getPackageName(); // getPackageName() from Context or Activity object
try {
    startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + appPackageName)));
} catch (android.content.ActivityNotFoundException anfe) {
    startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://play.google.com/store/apps/details?id=" + appPackageName)));
}