Untitled

mail@pastecode.io avatar
unknown
java
3 years ago
978 B
4
Indexable
Never
url = "gojek://gopay/merchanttransfer?tref=012021050617464403L8xbOmL8ID&amount=146000&activity=GP:RR&callback_url=someapps%3A%2F%2Fcallback%3Forder_id%3DIDORD%257B20210507124700%257D";

        binding.webView.getSettings().setJavaScriptEnabled(true);

        binding.webView.setWebViewClient(new WebViewClient() {
            @Override
            public boolean shouldOverrideUrlLoading(WebView view, String url) {
                Log.d("TAG", "shouldOverrideUrlLoading: "+ url);
                Intent intent;
                // allow these deeplink to be handled by OS
                if (url.contains("gojek://") || url.contains("shopeeid://")) {
                    intent = new Intent(Intent.ACTION_VIEW);
                    intent.setData(Uri.parse(url));
                    startActivity(intent);

                    return true;
                }
                return false;
            }

        });

        binding.webView.loadUrl(url);