"market://details?id=" + appPackageName打开的是应用而不是Playstore页面



我问了一个关于如何使用应用程序链接打开playstore页面的问题。我得到的答案是使用"market://details?id="+ appPackageName打开playstore应用程序,但不是打开playstore页面,而是重新打开我的应用程序。

enter code here
protected void Updateclick(View view) {
String appPackageName="io.kodular.samithuaz.smartQ";
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + appPackageName)));
}

试试这个。您需要为不同的存储指定适当的存储URI。参考链接

protected void Updateclick(View view) {
final String appPackageName = getPackageName();
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)));
}
}

我使用的是一个图像点击,为什么它不起作用。当我使用一个按钮点击它工作。

最新更新