TrinityTuts Tips

Open Play Store App from WebView Android

In this tip i show you how we can open android play store app from webview.

Open Play Store App from WebView Android .

String surl = obj.getString("URL");
WebView webView = (new WebView(this));
webView.getSettings().setJavaScriptEnabled(true);
webView.setWebViewClient(new WebViewClient() {
    @Override
    public boolean shouldOverrideUrlLoading(WebView view, String url) {
        Log.e("here", "++++++++++++++" + url);
        if (Uri.parse(url).getScheme().equals("market")) {
            try {
                startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
                return true;
            } catch (ActivityNotFoundException e) {
                // Google Play app is not installed, you may want to open the app store link
                return false;
            }

        }
        return false;
    }
});
webView.loadUrl(surl);

Also check: Android splash screen and webview
Hope this help you 🙂