I HAVE ALREADY TRIED How to handle intent:// on a webView URL? This solution just opens up a Google Play Store Web Page in my WebView, what I want is on the click, another app should open whose intent is provided as happens in Chrome.
My app has a WebView that works fine. At one stage, the WebView requests access to the following(an external payment app):
intent://pay/?pa=digitalshowroom1.payu@indus&pn=DOTPE%20PRIVATE%20LIMITED&tr=13261664955&tid=CX0FOrvSrHzDh7gP&am=1.00&cu=INR&tn=OrderId-CX0FOrvSrHzDh7gP
When I use the same website that my WebView is using in Chrome, it opens the external payment app successfully, i.e. Chrome is able to handle that intent, how can my app handle the same intent.
I seem to know I have to use
public boolean shouldOverrideUrlLoading(WebView view, String url)
for this, and I'm using it as follows:
public boolean shouldOverrideUrlLoading(WebView view, String url) {
if (url != null && (url.startsWith("whatsapp://") || url.startsWith("tel") || url.startsWith("market"))) {
view.getContext().startActivity(
new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
return true;
}
else {
return false;
}
Now, this piece of code is handling the intents like opening WhatsApp, Calling app, etc. fine as they start with whatsapp or tel, so I'm able to leverage the url.startsWith() method.
How can I handle the links that request access to external apps and start with intent://?
Thanks in advance!