"market://details?id=" + 应用程序包名称打开应用程序而不是 Play 商店页面

"market://details?id=" + appPackageName opens the app not the playstore page

我问了一个关于如何在我的应用程序上使用应用程序 link 打开 Playstore 页面的问题。我得到了使用“market://details?id=”+ appPackageName 打开 Play 商店应用程序的答案,但不是打开 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)));

}

尝试this.You 需要为不同的商店指定正确的商店 URI。 参考link

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)));
}
}

我用的是图片点击,为什么它不起作用。当我使用按钮点击时它起作用了。