gpt4 book ai didi

安卓 WebView : Why I can not able to redirect to play store from WebView?

转载 作者:行者123 更新时间:2023-11-30 02:10:32 28 4
gpt4 key购买 nike

我正在尝试将 url 传递给应该重定向到 play 商店的 webview,但它不起作用。

我试过的:

String url = "https://play.google.com/store/apps/details?id=com.matchify";
webView.loadUrl(url);

但它只在 webview 中加载,我该如何解决?

提前致谢

最佳答案

要在 Play 商店应用中打开您的应用/任何其他应用的页面,请使用:

startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + appPackName)));

appPackName 在哪里:

 String appPackName = getPackageName();

Play Store 应用程序有 Intent Filter,它会监听 Intent 并启动 uri(因为它以 market://开头,它将打开 Play Store。)如果你想在浏览器中打开,请使用 uri 参数:

https://play.google.com/store/apps/details?id=" + appPackName

有用的链接:How to open the Google Play Store directly from my Android application?

关于安卓 WebView : Why I can not able to redirect to play store from WebView?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30171230/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com