I am building a web application, and I would like my app to open app links.
However, I am having trouble determining if a url is an app link or a regular url.
Just like how chrome does, I would like my app to navigate within the app if the url is not an app link or deep link, but my current method opens all urls in external browser if it isn't from a specified host.
public boolean shouldOverrideUrlLoading(WebView view, String url) {
String host = null;
try {
URI u = new URI(url);
host = u.getHost();
} catch (URISyntaxException e) {
e.printStackTrace();
}
if (host == null || !host.contains("example.com")) {
try {
onActivity.startActivity(Intent.parseUri(url, Intent.URI_INTENT_SCHEME));
return true;
} catch (ActivityNotFoundException | URISyntaxException e) {
e.printStackTrace();
}
}
}
Is there a way that I can distinguish the behavior of app link navigation and plan url navigation?
Thanks