3

I would like to ask if there is any way to make TWA(Trusted Web Authority) app to open external links, those with different host than defined in AndroidManifest.xml, in new browser window instead of apps webview?

My AndroidManiest.xml look like this:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.placeholder">

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="${launcherName}"
        android:supportsRtl="true"
        android:theme="@style/Theme.TwaSplash">

        <meta-data
            android:name="asset_statements"
            android:value="${assetStatements}" />

        <activity android:name="android.support.customtabs.trusted.LauncherActivity"
            android:label="${launcherName}">
            <meta-data android:name="android.support.customtabs.trusted.DEFAULT_URL"
                android:value="${defaultUrl}" />

            <meta-data
                android:name="android.support.customtabs.trusted.STATUS_BAR_COLOR"
                android:resource="@color/colorPrimary" />

            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>

            <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:scheme="https"
                    android:host="${hostName}"/>
            </intent-filter>
        </activity>
    </application>
</manifest>

Thanks

Igor Mizak
  • 1,088
  • 1
  • 11
  • 19

1 Answers1

0

It's not currently possible to control how the link is opened from the Android app.

However, when an external link is opened in a Trusted Web Activity, it uses Custom Tabs and not the WebView. This means the user's underlying browser is used, which has the same web platform features and shares storage (eg: cookies) with the standalone browser.

andreban
  • 4,621
  • 1
  • 20
  • 49