My app consits of a web view and has the option to register as handler for links to https://example.com/news.
I have an 'Open in Browser' button that should open the current url in an external browser.
If my app is set as default handler for links to https://example.com/news, then the 'Open in Browser' button does not offer the option to open the url with a browser. Instead my app automaticalls opens the url.
I have seen that it's possible force an app to open urls in chorme, however I want a more general solution that works even if chorme is disabled/not installed. My question is then, how to open the url using any or the default browser?
The code for the 'Open in Browser' button:
if (url != null) {
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
}