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

♀尐吖头ヾ 提交于 2019-12-11 09:06:36

问题


I am trying to pass url to webview that should redirect to play store but Its not working.

What I tried :

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

but its loading only inside the webview, how can I solve this?

Thanks in advance


回答1:


To open your app's / any other app's page on play store app use :

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

Where appPackName is:

 String appPackName = getPackageName();

Play Store app has Intent Filter that will listen to the intent and launch the uri (since it is starting with market:// it will open Play Store. ) If you want to open in browser use uri argument :

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

Helpful link : How to open the Google Play Store directly from my Android application?



来源:https://stackoverflow.com/questions/30171230/android-webview-why-i-can-not-able-to-redirect-to-play-store-from-webview

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!