I'm currently building an Android app as a TWA following guidelines from Google's sample TWA project and have stumbled into an issue when trying to open external links from within the TWA.
From within my TWA, when opening an external link (such as Facebook or Instagram) and where I don't have an app installed that can handle the link, I want the link to open up in Chrome separately outside of my app. However, the TWA implementation is built around and within Google's Custom Tabs which seems to insist on loading the link within the Custom Tabs context.
The problem with opening external links from within my app like this is that when clicking the Close icon, it closes my entire app rather than just the view for the external link, which is obviously undesirable.
TL;DR Is there a way of enforcing external links from within Custom Tabs to be opened from outside the Custom Tabs context? Either as a separate Chrome activity or as a Web View would be sufficient.
Note, my app does have an intent filter and scope set:
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:host="www.example.com"
android:pathPrefix="/mobile"
android:scheme="https" />
</intent-filter>