Android Webivew Opening Android App Link as URL

194 views Asked by At

I'm trying to implement an Open Banking provider in a WebView in my React Native app.

The problem I am having is that when the provider (running on a webpage inside my WebView) tries to launch the banking app, the user is taken to the bank's website instead of their app.

I believe that the problem is that the Android App Links to the banking apps are being handled as URLs by the WebView. This all works perfectly if run in the browser.

I believe this is similar to the common problem with deep links (of the form banking-app://) not working in WebViews which can be resolved by overriding shouldOverrideUrlLoading on the WebView. This question illustrates the problem and the solution using shouldOverrideUrlLoading.

I therefore wonder if there is a similar solution which can be used to deal with Android App Links. I can't seem to find much information about how Android App Links are handled in WebViews.

It isn't immediately obvious to me how the shouldOverrideUrlLoading method can be used in this case since the provider I am using integrates with a growing (i.e. changing over time without notice) list of banks, all with their own Android App Link domain. Furthermore, each user will have a different combination of banking apps installed. In effect, I need to be able to handle arbitrary Android App Links so I can't simply intercept the URL and check if it meets some simple Regex condition since they are just normal URLs. What I need is some way of checking if there is an app on the device which can handle a link and then launching that app using the link.

0

There are 0 answers